Tagged: 

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1042636

    Just created a sticky post after updating to WordPress 5 and it’s not showing up on the top of my blog page.
    Any ideas?

    • This topic was modified 6 years ago by Jagrav. Reason: Correcting word phrasing
    #1043276

    Hey Jagrav,

    Can you give us temporary admin access to your website in the private content box below, so that we can have a closer look?

    Best regards,
    Victoria

    #1043333

    temporary admin access

    #1045976

    Hi Jagrav,

    Thank you for that.

    Which post are you referring to? I do not seem to find the sticky post.

    Best regards,
    Victoria

    #1046134

    Thanks Victoria,

    The sticky post is titled “Introduction” and should appear at the top of the blog page named “And This Too.”

    I designated the blog page in Dashboard: Enfold >
    Theme Options
    And where do you want to display the Blog?:
    “And This Too” page.

    There are two places to set the blog page

    1) Enfold > Theme Options >
    And where do you want to display the Blog?
    And This Too

    2) WP Admin: Settings > Reading >
    Your homepage displays
    Homepage: Home
    Posts page: –Select– (And This Too)

    Sticky post does not work with just “Enfold Theme Options”pointing to the blog.

    With “Enfold Theme Options” and “WordPress Settings > Reading>Posts page” designated I lose the Enfold display settings: single author, small preview pic (no author picture is displayed, featured image is small)

    I resorted to having both designating blog page settings on and setting the blog page date/time to be newer than all my other posts.

    Would be nice to have less of a work-around :)

    #1047125

    Hi,

    Thank you for using Enfold.

    Did you set the blog layout to “Use the advance layout builder..”? This filter might help:

    // sticky posts
    add_filter('avia_blog_post_query', 'avia_blog_post_query_mod', 10, 2);
    function avia_blog_post_query_mod($query, $params) {	
    	$include = array();
    	$sticky = get_option( 'sticky_posts' );
    
    	$args = array(
    	  'taxonomy' => $params['taxonomy'],
    	  'post__not_in' => $sticky,
    	);
    	$posts = get_posts( $args );
    
    	foreach($posts as $post) {
    		$include[] = $post->ID;
    	}
    
    	$include = array_merge($sticky, $include);
    
    	// convert values of the $include from string to int
    	function sti($n)
    	{
    		settype($n, 'int');
    		return $n ;
    	}
    
    	$include = array_map("sti", $include);
    
    	$query['post__in'] = $include;
    	$query['posts_per_page'] = 6;
    	$query['orderby'] = 'post__in'; // sort items based on the post__in value
    	return $query;
    }

    Best regards,
    Ismael

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.