Manual Custom Post Types and Muffin Blog

How does one go about displaying archives for CPT using the muffin blog element?  Is it possible or would one have to build an archive template and copy from the parent be theme?

Comments

  • Hey,

    this is unfortunately not possible. Sorry!
  • Thx. I was able to create my own template file for this using one of the be theme files =)
  • Hey pingram3541, can you share your solution here? :)
  • Yes but I must warn you that it is not for non-technical folks.  It requires using a child theme and applying some php code.

    My client needed a way to add a specials page listing coupons they offer and wanted a simply way to enter the price and description of the coupons.

    First, you can use probably any custom post type plugin out there but I personally opted for doing this manually through my child theme functions.php.


    Notice I added categories so i can have coupon categories so I could list/sort by type.

    Once that was done I had the new "Specials" post menu item in my WordPress admin bar but I needed to add the form fields that would direct the client to fill in the coupon details for the Discount, Description and Terms.  I opted to use the free plugin Advanced Custom Fields.

    I created a field group called Specials and added 3 basic text fields and gave them easy names (special_discount, special_text and special_terms) and I also used ACF to remove the unwanted post editor fields we don't need and would only confuse the client when adding in coupons.  There are tons of tutorials on youtube on how to use ACF but I'll assume you're familiar with this plugin.

    I then copied from the parent theme file template-archives.php and saved into my child theme folder named archive-specials.php (this is important to know how WordPress matches theme files based on the naming convention - found in wp codex).


    I modified the template to suit my needs, first getting the id of the page I was using for the "specials" listing so I could then get the muffin options such as the sidebar chosen, as archives don't really use a "page" by default in wordpress for its content.

    You'll also see where there are calls to:

    the_field("special_discount");
    the_field("special_text");
    the_field("special_terms");

    in the loops which output the custom fields provided from the ACF plugin. There is some other stuff so the coupons can be printable.

    I also added a custom js that only loads on this page by adding this to my functions.php - https://gist.github.com/pingram3541/b0fc316b799d0549c92b

    Good luck!




  • pingram3541 

    Thanks for the information on CPT,  i was wondering if you could point me in the right direction.
    I wish to create multiple CPT  with added custom fields for each.   I then wish to display these over 3 separate  pages.   Currently using the default  Be theme template for all pages with visual builder  So the 3 pages are already created I just wish to add the CPT and fields to display in a VC section within those pages.  As there are 3 CPT types i presume i would duplicate the adjusted defaulted template and alter the custom type and call that page then?


  • Sorry man I don't get any notices from these forums for some reason.  I've mentioned it before but I don't log in often enough.  I assume by now you find your solution but I would have likely suggested learning up on youtube/vimeo videos as there is tons of walk throughs for ACF.
  • edited October 2018
    Hi pingram3541,
    thanks a lot for sharing :-bd
    it perfectly work 

Sign In or Register to comment.