- This topic has 12 replies, 4 voices, and was last updated 1 year, 5 months ago by
Leo.
-
AuthorPosts
-
August 15, 2019 at 3:09 am #984635
James
Hello,
Only one post displays the whole post text on homepage. Other posts display titles without excerpts (I have set the excerpts length to zero).
I want to display titles only. What’s the problem of the only post? Please help me.
Thanks very much!
August 15, 2019 at 4:47 am #984684David
StaffCustomer SupportHi there,
seen this a couple of times before – for no explainable reason WP outputs the content.
What happens if you create a new post does that one display correctly?Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/September 14, 2019 at 9:29 am #1009457Olasiyan
Please I’m facing the same problem… I think it happens when you changed the post format from standard to any other format.
In my old theme, if I wanted to publish music I select format as music, video i select format as video…
Going through all my published post contents… All those posts showed the whole text content.September 14, 2019 at 9:30 am #1009460Olasiyan
Except those ones published in standard format… Even in search or tag pages they display the whole post contents
September 14, 2019 at 9:39 am #1009469Leo
StaffCustomer SupportHi there,
Try this PHP snippet:
add_filter( 'generate_show_excerpt', function( $show ) { if ( 'audio' === get_post_format() ) { $show = true; } return $show; } );
Adding PHP: https://docs.generatepress.com/article/adding-php/
Let me know if this helps π
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/September 14, 2019 at 10:15 am #1009491Olasiyan
Thanks it works
September 14, 2019 at 10:52 am #1009506Leo
StaffCustomer SupportNo problem π
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/September 17, 2019 at 12:28 am #1011258Olasiyan
I just detected this morning that same error occurred for videos as well… And what if i have other post format like Quote and others that I’ve used in my previous theme? How do we deal with that?
September 17, 2019 at 3:29 am #1011376David
StaffCustomer SupportHi there,
so this part of the code checks to see if its an audio post:
if ( ‘audio’ === get_post_format() )
We can extend that to check for multiple post formats eg.
if ( 'audio' === get_post_format() || 'video' === get_post_format() || 'quote' === get_post_format() )
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/September 17, 2019 at 3:43 am #1011391Olasiyan
I’m getting php error after inserting this new code
September 17, 2019 at 3:54 am #1011394David
StaffCustomer Supportthe code should look like this:
add_filter( 'generate_show_excerpt', function( $show ) { if ( 'audio' === get_post_format() || 'video' === get_post_format() || 'quote' === get_post_format() ) { $show = true; } return $show; } );
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/September 17, 2019 at 10:22 am #1011822Olasiyan
It did work for now… If I notice any error in any other format… Will get back to you
September 17, 2019 at 10:54 am #1011858Leo
StaffCustomer SupportYou can keep adding the condition in the if statement if you need other post format included as well.
You can see all of them listed here:
https://codex.wordpress.org/Function_Reference/get_post_formatDocumentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/ -
AuthorPosts
- You must be logged in to reply to this topic.