Sticky Posts to Show on Front Page

Home Forums Modern Sticky Posts to Show on Front Page

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #21918

    ESDNetwork
    Participant

    Sticky Posts to Show on Front Page

    Resolved

    Hey there! Have you noticed this support service is provided FREE of charge?
    If you like the speed and accuracy of resolutions, please consider supporting me with a small donation. Thank you

    Consider a donation →

    Hi Oliver,

    Is there a way to show sticky posts on front page when having a static page for homepage settings?

    I basically used your demo and modified it, so it would like to keep the same display on front page, but with an option to have sticky posts showing on front page instead of latest posts.

    Best regards,

    ÆSDNetwork

    • This topic was modified 3 weeks, 6 days ago by  ESDNetwork.
    #21920

    Oliver Juhas
    Keymaster

    Hi ÆSDNetwork,

    Indeed, sticky posts are ignored in “Front page” page template as they tend to mess post count in WordPress.

    If you really want to enable them for your homepage, use this code in your child theme‘s functions.php file:

    function child_theme_loop_query( $args, $context ) {
    	if ( 'loop-front-blog.php' === $context ) {
    		$args['ignore_sticky_posts'] = false;
    	}
    	return $args;
    }
    add_filter( 'wmhook_modern_loop_query', 'child_theme_loop_query', 10, 2 );

    Best regards,

    Oliver Juhas
    WebMan Design

    #21927

    ESDNetwork
    Participant

    Hi Oliver,

    Thank you very much, really appreciated.

    Best vibes,

    ÆSDNetwork

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

You must be logged in to reply to this topic.