-
AuthorPosts
-
March 27, 2014 at 11:10 pm #244099
Hi,
I created a new posttype called “offers”
I added a new function to functions.php:
add_filter('single_template', create_function( '$the_template', 'foreach( (array) get_the_category() as $cat ) { if (file_exists("/single-{$cat->slug}.php") ) return "/single-{$cat->slug}.php"; } return $the_template;' ) );I created a new file called single-offers.php
This page is the same as single.php only changed the line:get_template_part( 'includes/loop', 'index' );
to
get_template_part( 'includes/loop', 'aanbieding' );I created a new file called loop-offer.php t
and pasted the same code as in loop-index.php in there.
All is working perfect except.I want to edit the list overview of posts seperate from the single view of a post.
Please help me out here.
thanks
fabian
March 28, 2014 at 5:48 pm #244493Hi f!
Thank you for using the theme!
If you want to create a new post type, please follow this one. This is much more extensive and you’ll be able to select the post type when using the Blog Posts or Masonry elements. Duplicate the includes > admin > register-portfolio.php file. Rename it to something else, for example register-life.php. Replace it with this code: http://pastebin.com/ZBpzgbSe
Add this on functions.php:
require_once( 'includes/admin/register-life.php' ); // register custom post types for life entriesThis will register the custom post type life. You can now select the Life Entries when you’re using the Blog Posts or Fullwidth Masonry elements. Replace “life” with “offers”.
Best regards,
IsmaelApril 27, 2014 at 8:48 pm #256854Hi Ismael,
This was all very helpful and working, thank you.
How can I create a page like the loop-index.php for the new taxonomy I want the overview to have a different design.
thanks
April 28, 2014 at 6:51 pm #257240Hey!
You can copy the file and include it into the layout using get_template_part as needed (with your own named file).
Best regards,
Devin -
AuthorPosts
- You must be logged in to reply to this topic.
