Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #246211

    last time i tried to change the functions.php file with the following code

    add_filter('the_posts', 'bump_sticky_posts_to_top');
    function bump_sticky_posts_to_top($posts) {
        foreach($posts as $i => $post) {
            if(is_sticky($post->ID)) 
            {
                $stickies[] = $post;
                unset($posts[$i]);
            }
        }
        
        if(!empty($stickies)) 
            return array_merge($stickies, $posts);
        
        return $posts;
    }
    

    it just broke and started to give me the following error upon access:

    Warning: require_once(config-wpml/config.php): failed to open stream: No such file or directory in /home4/aum/public_html/wp-includes/functions.php on line 29
    
    Fatal error: require_once(): Failed opening required 'config-wpml/config.php' (include_path='.:/opt/php55/lib/php') in /home4/aum/public_html/wp-includes/functions.php on line 29

    any suggestions how to make it work? the website url is: http://www.oshonow.net

    #246920

    Hi akhilz!

    Please insert the code into wp-content/themes/enfold/functions.php and not into wp-includes/functions.php.

    Best regards,
    Peter

    #247716

    thanks Peter

    have done as directed.

    works on one of the pages: http://oshonow.net/seekers-diary/

    but not on the homepage as yet: http://oshonow.net
    strange?

    please help.

    #247754

    Hi!

    Yes, it’s weird. Unfortunately sticky posts won’t work properly with the category__in query parameter – see: http://core.trac.wordpress.org/ticket/25815

    I suggest to try a plugin like: http://wordpress.org/plugins/post-types-order/ – it enables you to change the sort order of the posts easily and you can use it to add your “sticky posts” to the very top.

    Regards,
    Peter

    #248109

    hi Dude
    i was working on something else entirely and changed the Blog Style back and forth with Multi Author and Single Author styles and somewhere along the line i realized that sticky post has started working on the home page as well. strange but it happened, check http://www.oshonow.net
    am not code friendly so wouldn’t know what made it work, informing you so others may be helped!
    thanks.

Viewing 5 posts - 1 through 5 (of 5 total)
  • The topic ‘Sticky Posts Not Working’ is closed to new replies.