Display the full post content in specific contexts


Note :This snippet works only with the Classical style option. The Classical style option can be enabled in Appearance > Customize > Advanced > Theme Style. More about the theme style option here


Updated March 2015 This snippet applies to Customizr > 3.3.1 and Customizr-Pro > 1.0.12. If you’re running an older version replace ‘tc_show_excerpt’ with ‘tc_show_post_list_excerpt’

The Customizr theme allows you to set the length of the posts content (full content or excerpt) in list of posts (blog page, home, archives, …) in Appearance > Customize > Pages & Posts Layout.

This global option will then apply to all the lists of posts of your website.

If you need to apply a specific length to your posts for a given context, then you will need to use a hook called : ‘tc_show_post_list_excerpt’. This is actually a boolean filter : if set to true, your posts will show their excerpts, if set to false, your posts will be displayed in full content.

Note: This snippet doesn’t apply in context where you use the Grid layout.

 

Let’s assume that you have set the global option to excerpt and you need to display your blog posts in full length only on home page. The following snippet will do it :

As always, don’t forget to do all your customizations in a child theme as explained here.


Related Snippets you may also like


We can help you to implement this snippet

Coding is our job and we know WordPress inside and out. We can help you to customize your website with small chunks of code snippets like this one.

Send us your request and we'll get back to you quickly.



9 thoughts on “Display the full post content in specific contexts

  • Sharon

    Hello!

    I’m so grateful to find this post! I have a specific “context” that I can’t seem to find the code for anywhere…

    I have a certain category that is hidden on my blog’s main page (index.php) called “coming soon”. Right now, it can only be accessed through certain links in a tagcloud that I converted into a menu.

    I would like this specific category to show up full, but have all else remain excerpts.

    Do I change the following code in my archive.php only?

    And if so, what do I change it to, to have category 31 (Coming-soon) show up full when the corresponding tag (such as “fish and seafood”) is clicked?

    I’d appreciate any help you can give!

    Kindly,
    Sharon
    thenourishedcook.com

    • Nicolas Post author

      Hi Sharon, there seem to be a confusion between the tags and categories concept in what you describe…
      From what I understand and I can see on your website, you have created a post called “Coming soon” that you have assigned to
      1) the category coming soon
      2) at least on tag named fish and seafood
      Your theme is apparently not Customizr or Customizr child so the above snippet will not apply.
      If the theme uses the WordPress template hierarchy, you can create a specific template named category-31.php.

      Hope this helps

      • Sharon

        Oh no! So sorry I never replied- I never saw your answer! Funny, it’s a year later, and I was just restarted my quest to figure this out. It took me right back where I started! 🙂 I think I might have some ideas now though. Just wanted to thank you for your time!

  • Markus Frieauff

    Can I also apply this to a “page” I created by adding a category to the menu? I want a separate page for all posts of a certain category, but I want to show the entire posts there. How can I do that?

    • Nicolas Post author

      Hi Markus, you can easily do that with the is_category() conditional tag.

      Replace my-category by the slug of your category in the example below.

      Hope this helps!

      • Markus Frieauff

        Cool, thanks! And how can I do that with multiple categories? I have two pages each made up of the posts of one specific category. I tried

        as well as

        but neither of the two works.
        (Sorry, I am a complete newbie to PHP)

          • Markus Frieauff

            Uhm, the link is not working. Can you point me to another place where I can find the code? I did a search on “array of categories”, but didn’t find anything that looked suitable.

            • Markus Frieauff

              Ok, I think I found it. I am using

              Seems to work. Any issues to expect with that?

              }

Comments are closed.