Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • #361870

    For my blog I like to split post up into:
    – personal blog posts
    – photo blog posts

    What 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
    #362332

    Hey 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!
    Elliott

    #362540

    Hi 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 job

    Hope 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!
    Marc

    #362560

    Hmm, doesn’t work…

    Yes, I managed to create a blog page with image posts only:
    http://marcbijl.nl/foto-blog

    However, 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…

    #362564

    The 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?

    #363283

    Hmm, 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-245040

    Can you guys please help me to get going?

    #363288

    Hmm, 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
    – Photography

    #363293

    Allright, 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?

    #363303

    Also tried this one, but it’s not working for me:
    https://kriesi.at/support/topic/avia-post-nav-with-the-same-category/#post-185420

    #363310

    Hmm, 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?

    #363314

    Ok, it means priority, and default is 10:
    http://codex.wordpress.org/Function_Reference/add_filter

    #363821

    Hi!

    Hehe, I see what you mean now. Glad you got it sorted. Let us know if you have any other questions.

    Best regards,
    Elliott

    #363906

    Yeah, 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.at

    If 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!

Viewing 13 posts - 1 through 13 (of 13 total)
  • The topic ‘How to create Custom Post Type (CPT) and will previous & next links work?’ is closed to new replies.