Issues adding a Custom Post Type to Theme
-
Hi Michael,
I’ve added your plugin and seen the ‘Please note that this plugin will NOT handle display of registered post types or taxonomies in your current theme.’ I think my issues are display issues but I just wanted to check I hadn’t missed anything obvious using the plugin.
I’ve installed the plugin and added a recipe post-type;
- all settings are set to true with the exception of Exclude from Search
- all support features I require are ticked
- all built in taxonomies including WP core and the ones I’ve set up are ticked
- all taxonomies (6 of them) are set up with attach to post type recipe & post
- all settings set to true with the exception of Show in REST API and Show in quick edit
As I’ve noted below, the post-type generally seems to be working i.e. can publish a post, view it (after adding some code) on category & tag archives, add new taxonomy terms, use the taxonomies in a filter plugin, use them in other plugins e.g. post loop widget.
Am I missing anything or is it just a theme display issue I have to solve (see below)?Sorry for the long post. Also, my site is hiding behind a coming soon page so I can’t really send a link, but happy to provide information if there is another way.
Thanks
PhilFor additional info:
I posted the following on my theme provider support:I’m looking for some guidance on adding custom post types to your ScrollMe theme (which, thank you, I really like!).
Apologies in advance for a long intro: I am creating a food / recipe site and (believe) have to use custom post types for the filtering functionality I would like. I have added the Custom Post Type UI plugin, followed the setup instructions, and it appears to have done it’s job. I have the following in place:A child theme
New Post Type -> Recipe
Custom Taxonomies -> Menu, Ingredients, Chef etc…
Terms -> e.g for Menu – Breakfast, Main Course etc…I can create a ‘Recipe’ post-type and publish it. The post is visible using mysite.com/recipe/recipename.
The recipe-post is assigned to a core category I’ve called ‘Portfolio’ which I want to use for the portfolio section in the theme.
The post is assigned to menu & ingredient terms which I require for filtering my posts.
Categories & Tags (WP Core) built in taxonomies have been ticked for inclusion in the plugin.The category view via the archive.php template mysite.com/recipe works with a title ‘Archive: Recipes’ and includes my recipe post types (I’ve added code to my functions.php to make this happen – without the code it only shows core post-types) and likewise for a tag view mysite.com/tag/tag1 shows recipe post types (title ‘Tags: Tag1’).
A taxonomy view via the archive.php template e.g. mysite.com/recipe/menu/breakfast or mysite.com/menu/breakfast also includes the recipe post-types with the correct title ‘Menu: Breakfast’. So far, so good.
The bits I’m struggling with (I’ll include them all as they may be related to actions I need to take having registered the CPT)
Issue 1: To set up the portfolio section in the theme, when I choose the ‘Portfolio’ category in the Portfolio settings, only the core post-types show up in the section. How can I include the recipe post-type in this section? (I tried other categories I linked to recipe post-type to no avail). I cannot figure out what is missing?
I tracked the code back to line 22 in the customizer.php file[$this->cats = get_categories( $options );]
and looked up the function which I don’t think directly supports CPTs. What code do I need to add to update this? (if this is where the problem is)Issue 2: I’ve added the Beautiful Taxonomy Filter plugin which is basically working (as sidebar widget). However on the category archive views the ‘placeholder’ i.e. All Recipes, All Menus does not appear on the filter but the individual taxonomy terms are in the dropdown. (It is ok with the tags archive or other taxonomy archives).
Issue 3: The sidebar layout box does not appear in the edit recipe-post meta-boxes. If I add manually add the custom field ‘scrollme_sidebar_layout’ it does not function correctly i.e. whilst both left & right sidebars will show on a recipe-post, they are both on the right hand side as the css does not work – the option no_sidebar does the following:
Per Recipe post
<body class=”single single-recipe postid-148 single-format-standard logged-in custom-background siteorigin-panels”> (hasn’t picked it up therefore shows post at 70% not full width)
However when working:
Per Single post
<body class=”single single-post postid-83 single-format-standard logged-in custom-background no_sidebar”>Issue 4: I’ve added the AccessPress Social Share plugin which is working on the single posts. The sharing buttons do not show on the recipe post-type. How do I update for this?
I can manually add in the shortcode (to the post or template) and know that works.Hope you can assist?
Thanks
Phil
- The topic ‘Issues adding a Custom Post Type to Theme’ is closed to new replies.