Tagged: , , ,

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #251367

    I have a site where the content needs to be dripped (using wishlist member and wp-drip), on the visual aspect of the blog posts/categories and when you add a “blog” section to a “page” I need the default order to be in order

    i.e.

    Post #1
    Post #2
    Post #3

    the way they display by default is
    post #3
    post #2
    post #1

    how can this be changed in the enfold theme?

    found a plugin that works well, I don’t know that I’d recommend this if you already have tons of articles posted, but if you are working on a new site build and can order as you go along, this is great; https://wordpress.org/plugins/post-types-order/

    actually, it doesn’t work… it removes the menus so I’m back to the same problem as before… I need to list the posts in chronological order
    post 1
    post 2
    post 3

    and everywhere they display they have to post in this fashion… whether it be a category page, archive page, blog page or a page with a blog section on it.

    please help

    original post: https://kriesi.at/support/topic/change-blog-post-order/

    #251381

    anyone? please? I’ve tried 20 different p,ugins…. they each end up making the navigation menu disappear.

    #251968

    Hi!

    I’m not sure which blog type you’re using but you can use this code:

    
    if(!function_exists('avia_change_posts_query'))
    {
    	function avia_change_posts_query($query, $params)
    	{
    	    if(!empty($query['post_type']))
    	    {
    	            if((is_array($query['post_type']) && in_array('post', $query['post_type'])) || $query['post_type'] == 'post')
    	            {
                                $query['order'] = 'ASC';
    	            }
    	    }
    	
    	    return $query;
    	}
    	
    	add_filter('avia_masonry_entries_query', 'avia_change_posts_query', 10, 2);
    	add_filter('avia_post_grid_query', 'avia_change_posts_query', 10, 2);
    	add_filter('avia_post_slide_query', 'avia_change_posts_query', 10, 2);
    	add_filter('avia_blog_post_query', 'avia_change_posts_query', 10, 2);
    }
    
    

    to manipulate the query of all posts. You can replace ASC with DESC for an descending order.

    Cheers!
    Peter

    #252939

    I am having the same problem, where would I find this code in order to change the order?

    #252945

    if i’m not mistaken the code will go in the functions.php file. that’s usually where functionality changes and actions like this go.

    #252955

    I added it to the bottom of my functions.php file but it didn’t seem to do anything. It would be nice if this option could be incorporated into the theme options itself.

    #254219

    Hey!

    If you use a “Advanced Layout Builder” element the code should work. If you want to change the main query, etc. on the blog page it might not work.

    Regards,
    Peter

    #259157

    I tried adding
    query_posts(‘order=ASC’);
    to the loop on index-loop.php

    While that did change the order, it was not restricted to posts within that category. It was listing the first post ever posted at the top of every single category. Is there any other way to change the default order of normal blog posts within this theme?

    I have 79 categories and 1500+ posts. Manually changing their dates to get the order I need is not practical.

    Any help would be appreciated.

    #259280

    Hey!

    You can try to change the main query var with a filter – insert it into the functions.php file:

    
    function my_modify_main_query( $query ) {
    $blogpage_id = avia_get_option('blogpage');
    $id = @get_the_ID();
    if ( $id  ==  $blogpage_id ) {
    $query->query_vars['order'] = ASC;
    }
    }
    // Hook my above function to the pre_get_posts action
    add_action( 'pre_get_posts', 'my_modify_main_query' );
    

    Make sure the “blog page” option is set on the theme option page – otherwise the check $id == $blogpage_id (current page = blog page) may not work.

    Cheers!
    Peter

Viewing 9 posts - 1 through 9 (of 9 total)
  • The topic ‘Reopen– blog order help’ is closed to new replies.