Blog Preview Not Working on dedicated blog Page

Home Forums Receptar Blog Preview Not Working on dedicated blog Page

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #17711

    kevindk
    Participant

    Blog Preview Not Working on dedicated blog Page

    Resolved

    Hello again!

    I would like to get the typical blog previews on my dedicated blog page and also exclude the sticky posts from showing here. So only new posts can show a preview here minus breadcrumbs.

    I have tried several things and the only thing I get is a excerpt, or long preview of an old post that I actually don’t want there but my new post will not show.

    What do you think this could be??

    Thanks as always for the amazing, fast support!

    #17715

    Oliver Juhas
    Keymaster

    Hi kevindk,

    Please note that your blog page is not correctly set up. The page you’ve linked to seems to be a standard static page with Beaver Builder content. If you want to display blog posts there, please set it properly in WordPress settings https://webmandesign.github.io/docs/receptar/#pages

    For sticky posts please use a custom function in your child theme‘s functions.php file:

    function child_theme_ignore_sticky_posts( $query ) {
    	if ( $query->is_main_query() ) {
    		// This makes sticky posts display in order.
    		$query->set( 'ignore_sticky_posts', 1 );
    		// This will exclude sticky posts from display maybe?
    		$query->set( 'post__not_in', get_option( 'sticky_posts' ) );
    	}
    }
    add_action( 'pre_get_posts', 'child_theme_ignore_sticky_posts' );

    Please note that I provide no guaranty of this working the way you want. Excluding sticky posts from displaying in blog page might require more coding, which is beyond the free support I provide – please read terms of service.
    I suggest to hire some WordPress developer to help you tweak your site to your needs.

    However, I suggest rethinking your website structure. This seems to be a misusing sticky posts from my point of view. Maybe you just want to display posts from a specific category on your blog page? If so, adapt the code above accordingly.

    Best regards,

    Oliver Juhas
    WebMan Design

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.