[Resolved] Showing automatic excerpt on the wp-show-posts list

Home Forums Support [Resolved] Showing automatic excerpt on the wp-show-posts list

Home Forums Support Showing automatic excerpt on the wp-show-posts list

Viewing 14 posts - 16 through 29 (of 29 total)
  • Author
    Posts
  • #926111
    David
    Staff
    Customer Support

    You can set the excerpt to 0 in the Customizer > Layout > Blog
    WP Show Posts has its own control for the excerpt.
    Or what am i missing?

    #926138
    Hasan

    The excerpt length is already set to 0 in the customizer: http://prntscr.com/o0k8u8

    Seems like it does not work for the manual excerpts. I have set manual excerpt for only one page, which is being shown here: https://snapbangladesh.com/

    Setting the excerpt length to 0 on the show post settings does not affect the archive pages: http://prntscr.com/o0ka2k

    Any idea?

    #926141
    David
    Staff
    Customer Support

    Aah – only Auto Excerpts can be limited in length by the customizer.
    May i ask why the manual excerpt if you’re not going to display it?

    #926155
    Hasan

    In the show post list here, I’ve set the excerpt length from the show posts settings to 70 word, which shows the full paragraph when I have small text on any post.

    But if the post is with long text, it shows exactly 70 words and shows “…” in the end, combining the paragraphs and removing the gap between the paragraphs, which does not look good. On this case, if I provide a manual excerpt, it shows one full paragraph nicely, hence the necessity of using manual excerpt for the long posts.

    Will appreciate any idea to stop it being generated on the archive pages.

    #926194
    Leo
    Staff
    Customer Support

    I don’t believe there is a way to overwrite manual excerpt as that kind of defeats the purpose as David mentioned.

    If it’s just for one post maybe we can try CSS to hide it?

    Can you link me to the page in question and direct me to the post?

    #926202
    Hasan

    This is not for just one post. Will be many many posts when the site is fully developed. So hiding with CSS is not an option.

    Here is the archive page: https://snapbangladesh.com/stories/
    Here is the long post in question: https://snapbangladesh.com/ahsan-manzil-pink-palace-old-dhaka-front-view-2/
    And the show post list: https://snapbangladesh.com/stories/

    #926208
    Leo
    Staff
    Customer Support

    Unfortunately I don’t believe there is a way to go around it without some custom solution.

    Custom excerpt (a WordPress core function) is meant to be displayed when used.

    You could try asking WordPress’ support to see if they have any workaround solution or a forum like this:
    https://stackoverflow.com/

    #926233
    Hasan
    /*
    	Remove excerpts from the achrive pages only
    */
    
    add_filter( 'wp_trim_excerpt', 'db_excerpt_metabox_remove' );
    function db_excerpt_metabox_remove( $excerpt ) {
    	$output = $excerpt;
    	
    	if ( is_archive() && has_excerpt() ) {
    		$output = '';
    	}
    	
    	return $output;
    }
    

    Got this code from an old support thread, which should remove the manual excerpt from the archive pages. Any idea why this does not work?

    #926241
    Leo
    Staff
    Customer Support

    Here is the archive page: https://snapbangladesh.com/stories/

    This is actually just a static page and not an archive page.

    #926257
    Hasan

    This is strange! On further research, using the last code I posted actually removes the manual excerpt from the archive pages: https://snapbangladesh.com/tag/dhaka/

    But not from the home page, which is also an archive of posts: https://snapbangladesh.com/

    Any idea?

    #926261
    Leo
    Staff
    Customer Support

    Home page as posts page requires the other conditional tag:
    https://codex.wordpress.org/Conditional_Tags#The_Main_Page

    #926274
    Hasan

    Modified the code as the follows, and it resolved the issue – if it helps someone else in future:

    /*
    	Remove excerpts from the achrive pages only
    */
    
    add_filter( 'wp_trim_excerpt', 'db_excerpt_metabox_remove' );
    function db_excerpt_metabox_remove( $excerpt ) {
    	$output = $excerpt;
    	
    	if ( is_archive() && has_excerpt() ) {
    		$output = '';
    	} elseif ( is_home() && has_excerpt() ) {
    		$output = '';
    	}
    	
    	return $output;
    }

    Thanks Leo for pointing toward this! Apparently it was not impossible to do.

    Thank you so much David for going above and beyond to resolve this issue! I’ve experience of working with support of several top selling themes, but I can honestly say, from you I’ve received the best theme support ever! Kudos!! ๐Ÿ™‚

    #926283
    Leo
    Staff
    Customer Support

    Glad we could help ๐Ÿ™‚

    Please note that WP Show Posts is actually separate support forums:

    Free: https://wordpress.org/support/plugin/wp-show-posts/
    Premium: https://wpshowposts.com/support/area/pro-support/

    Please consider using them in the future.

    Thanks for your support!

    #926745
    Hasan

    No problem!

Viewing 14 posts - 16 through 29 (of 29 total)
  • You must be logged in to reply to this topic.