Tagged: CPT, Custom Post Type, layout settings, next, previous
-
AuthorPosts
-
December 3, 2014 at 12:21 am #361870
For my blog I like to split post up into:
– personal blog posts
– photo blog postsWhat is the best way to create these Custom Post Types (CPT):
– Manually (how)?
– Plugin: Custom Post Type UI?
– Plugin: Types?
– …And if a Custom Post Type has been created, will I be able to page through the posts of a single type by using the previous and next links (which are already available for standard posts as well as portfolio items)?
Finally, will I also be able to set layout options, like layout, sidebar, footer, title bar, header visibility and transparency?
- This topic was modified 9 years, 11 months ago by Marc Bijl. Reason: Added an extra question at the end
December 3, 2014 at 6:27 pm #362332Hey Marc!
Have you considered using post formats? http://www.wpbeginner.com/glossary/post-formats/
The previous and next links will still work with them and you can create custom lists with our blog posts element. Just select a custom taxonomy and then choose whatever post format you want to display.
Cheers!
ElliottDecember 3, 2014 at 10:31 pm #362540Hi Eilliot,
I’ll give that a try, thnx!
Did you do the same at your own website? What I see over there is this (and that’s not what I want):
– Click on blog > photos
– Notice the first one is about winter wonderland, the second about horses you take care of
– Click on the post about winter wonderland
– Notice the previous buttons does not link to the horses, but about a new jobHope you understand what I mean?
Anyway, I’ll dive into it and see what it brings! In the meanwhile looking forward to a response about the things above…
Cheers!
MarcDecember 3, 2014 at 10:52 pm #362560Hmm, doesn’t work…
Yes, I managed to create a blog page with image posts only:
– http://marcbijl.nl/foto-blogHowever, when flipping through these image posts, the next/previous buttons contain standard posts too.
What I want is:
1. Create a photo blog, that is a list of image posts only, and if I click on such a post, the next and previous buttons should only show other image posts
2. Create a personal blog aside, that is a list of standard posts only, and if i click on such a post, the next and previous buttons should only show other standard post (not the image posts!).Hope this makes things clear…
December 3, 2014 at 10:58 pm #362564The same happens btw if I create a blog list with image posts based on taxonomy term Fotografie (term Photography): looking at the photography list (category/fotografie), clicking a single post, and using the next/previous buttons, shows that this wil flip through standard posts (term Personal) too…
However, when I page through my portfolio items (starting from here: http://marcbijl.nl/portfolio-webdesign-vormgeving-presentatie), the next/previous buttons only show other portfolio items (and no blog posts).
So that means I do need to make a custom post type, I guess?
December 4, 2014 at 10:27 pm #363283Hmm, wondering if this is a point to start from when using taxonomy categories (instead of custom post types):
– https://kriesi.at/support/topic/portfolio-link-arrows/#post-245040Can you guys please help me to get going?
December 4, 2014 at 10:46 pm #363288Hmm, the link above (https://kriesi.at/support/topic/portfolio-link-arrows/#post-245040) tells how to get category-specific next and previous buttons for the portfolio.
Based on this, I got it going for the complete website by adding this code to functions.php:
function category_specific_post_nav($settings) { $settings['same_category'] = true; return $settings; } add_filter('avia_post_nav_settings','category_specific_post_nav', 10);
Now I only want to get it working for my blog posts, and then basically for only those two taxonomy terms:
– Personal
– PhotographyDecember 4, 2014 at 10:54 pm #363293Allright, got it kind of working by adding this code to functions.php:
function category_specific_post_nav($settings) { if($settings['taxonomy'] != 'portfolio_entries') $settings['same_category'] = true; return $settings; } add_filter('avia_post_nav_settings','category_specific_post_nav', 10);
However, this code won’t get a certificate for ‘Excellent Coding’ I guess. What should I use instead of
!= 'portfolio_entries'
to assign blog posts only?December 4, 2014 at 11:15 pm #363303Also tried this one, but it’s not working for me:
– https://kriesi.at/support/topic/avia-post-nav-with-the-same-category/#post-185420December 4, 2014 at 11:30 pm #363310Hmm, seems I got it working. I added this to functions.php:
function category_specific_post_nav($settings) { if($settings['taxonomy'] == 'category') $settings['same_category'] = true; return $settings; } add_filter('avia_post_nav_settings','category_specific_post_nav', 10);
Now, when paging through blog posts, the previous and next links only show posts from the same category. This way it does not work for the portfolio items, which is fine for me (at least, for now).
Last question: what does the 10 mean in the code?
December 4, 2014 at 11:35 pm #363314Ok, it means priority, and default is 10:
– http://codex.wordpress.org/Function_Reference/add_filterDecember 5, 2014 at 8:48 pm #363821Hi!
Hehe, I see what you mean now. Glad you got it sorted. Let us know if you have any other questions.
Best regards,
ElliottDecember 5, 2014 at 11:08 pm #363906Yeah, guess it would be a nice feature in the dasboard to be able to set how previous and next links should work: either without limitations (paging through all posts), or with limitation (e.g. paging through posts of same category or something).
I know you guys have a feature request page, but I’ve seen so many questions about such a feature (also for the portfolio part of the site), that you guys should draw conclusions:
– https://www.google.nl/search?q=previous+next+category+site%3Akriesi.atIf a noob like me can get this working by changing some code, it shouldn’t be that difficult for you guys ;-)
Anyway my problem’s solved, cool!
-
AuthorPosts
- The topic ‘How to create Custom Post Type (CPT) and will previous & next links work?’ is closed to new replies.