Tagged: x
-
AuthorPosts
-
June 3, 2016 at 8:16 am #1024138
I have read multiple posts on how to create templates for a custom post type (I want them to look like the blog, just not included in the blog). So I know I need to create templates, but keep getting 404s when i follow other posts.
I created a custom post type “Recipes”. I am using Ethos stack. What files do I need to create (duplicate/rename) to make it show just the custom post type but look like the blog?
June 3, 2016 at 7:26 pm #1024913Hi there,
Thanks for writing in.
It should display even if don’t have custom templates because it will use blog templates by default. Hence, if you need to make it look like the blog post, then no need to create custom templates.
What you need to fix is why it’s displaying 404, once you create a post type, you should set valid permalink then go to Admin > Settings > Permalinks and flush it by resaving it.
And if you’re planning to create index/home page for your custom post types, then you can simply use a standard page with the essential grid.
Thanks!
June 5, 2016 at 11:20 am #1026740You are right the post shows fine. Except is has the sidebar from the blog as a whole and doesn’t have any “internal” navigation to the Recipes area. Ideally it would have a “category”/”homepage” for the recipes that has a sidebar for the area, breadcrumb, and header specific to the recipes area.
June 5, 2016 at 10:11 pm #1027295Hello There,
Thanks for the updates! Regretfully, this particular customization request is outside the scope of our support as this is not related to an issue with the theme and instead has to do with your customization of it. As such, you will need to investigate this particular issue on your own or seek help from a developer should you not feel comfortable making these changes yourself. If you have any further questions about the theme, we are more than happy to provide you with assistance on these inquiries.
Thank you for your understanding.
June 10, 2016 at 1:57 pm #1036260Ok I understand I have been able to get the archive page to show by creating archive-recipes.php file using (I believe page.php) and have a simibilance of the archive page showing looking like the blog minus the carosel at the top. Can you help me to understand how I can adjust this page to reflect its unique area by creating a view. I see “x_get_view( x_get_stack(), ‘wp’, ‘page’ );” and have seen lots of examples on the forum, but none have the “wp”. It’s always (stack, ‘view’). When I change it to ‘recipe’ and have a recipe.php in the ethos/framework folder of my child theme the page doesn’t render. Any help?
June 10, 2016 at 8:30 pm #1036746Hello There,
All you need to do is to create a file name as recipe.php and add it in your child theme. It’s content should look like this:
<?php // ============================================================================= // RECIPE.PHP // ----------------------------------------------------------------------------- // Handles output of individual recipe posts. // // ============================================================================= $fullwidth = get_post_meta( get_the_ID(), '_x_post_layout', true ); ?> <?php get_header(); ?> <div class="x-container max width main"> <div class="offset cf"> <div class="<?php x_main_content_class(); ?>" role="main"> <?php while ( have_posts() ) : the_post(); ?> <?php x_get_view( 'ethos', 'content', get_post_format() ); ?> <?php x_get_view( 'global', '_comments-template' ); ?> <?php endwhile; ?> </div> <?php if ( $fullwidth != 'on' ) : ?> <?php get_sidebar(); ?> <?php endif; ?> </div> </div> <?php get_footer(); ?>
Once saved, you should save this file in wp-content/themes/x-child/ folder. Hope this helps.
June 13, 2016 at 10:48 am #1039795This reply has been marked as private.June 13, 2016 at 10:54 am #1039803If I understood how to make “archive-recipe.php” use a view like the blog, then I can setup custom fields to simulate the blog “Post Carousel Display” fields. I just want it to be its own “blog”. that way when the client creates recipes it’s all formatted uniformly. Does this make sense?
June 13, 2016 at 12:19 pm #1039971Hi There,
In my opinion the best way of achieving that is trough Cornerstone. I have done this before when creating sites for my clients. What I did was creating 3 4 template post types in Cornerstone with Placeholder Images and Lorem Ipsum text boxes. I created more than one layout specially for the case of the client having a longer post than other, I guess this could apply for recipes a well.
Once you have this post templates on Cornerstone your client will be able to choose from the choices you left ready for him just copy and paste text and upload the images. Beside that feature list sound like a really intersting element in my opinion to describe a recipe step by step.
Let us know your thoughts on that.
Thanks
Joao
June 13, 2016 at 12:25 pm #1039975yeah I guess that works, in one way. However this is a basic WordPress feature to create custom post types. I have my reasons for using it rather than cornerstone templates. I don’t know why I am getting such a runaround on support of it. There should be an easy 1-2-3 step for this. What files and views need to be created to duplicate the functionality.
I have the single view working the way it should I just need to understand how to create an archive page.
June 13, 2016 at 11:51 pm #1040753Hi There,
Did you change your login URL? I did check wp-admin and wp-login.php from your site and it redirects me to not_found URL. I just want to check what you currently have. To summarize, you want a archive template and single post template for this custom post type, correct? Please do give us the login link.
June 14, 2016 at 7:50 am #1041305This reply has been marked as private.June 14, 2016 at 8:29 am #1041372Also how can I get the custom post type to show up as an option in “Taxonomies” for a sidebar?
June 14, 2016 at 11:35 pm #1042653Hi There,
Thank you for the correct link.
Create a file archive-recipes.php on your child theme folder.
The content would be like this:// ============================================================================= // RECIPE ARCHIVE PAGE // ----------------------------------------------------------------------------- // Handles listing of recipe posts. // // ============================================================================= <?php get_header(); ?> <div class="x-container max width main"> <?php x_get_view( 'ethos', '_post', 'slider' ); ?> <div class="offset cf"> <div class="<?php x_main_content_class(); ?>" role="main"> <?php $args = array( 'post_type' => 'recipes', 'posts_per_page' => $count, 'paged' => $paged ); $wp_query = new WP_Query( $args ); ?> <?php if ( have_posts() ) : ?> <?php while ( have_posts() ) : the_post(); ?> <?php x_get_view( $stack, 'content', get_post_format() ); ?> <?php endwhile; ?> <?php else : ?> <?php x_get_view( 'global', '_content-none' ); ?> <?php endif; ?> </div> <?php get_sidebar(); ?> </div> </div> <?php get_footer(); ?>
As you can see from above code we have this:
$args = array( 'post_type' => 'recipes', 'posts_per_page' => $count, 'paged' => $paged ); $wp_query = new WP_Query( $args );
Above code resets the query to just the custom post type.
Feel free to remove this line if you don’t want the ethos slider
<?php x_get_view( 'ethos', '_post', 'slider' ); ?>
Further customizations from here would be getting into custom development, which is outside the scope of support we can offer. If you need more in depth changes, you may wish to consult with a developer. X is quite extensible with child themes, so there are plenty of possibilities. Thanks for understanding.
-
AuthorPosts