Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #528284

    First it’s important to note that I’ve customized my archive page already to create the sidebar I need to the left. And I’ve also customized my avia builder with the ability to sort posts alphabetically.

    I’ve tried every suggestion in the forums to sort my archive pages automatically alphabetically but I’m getting nowhere. None of the solutions work. Including the suggested additions to the functions.php file. I’ve left those in place for your reference. I’ve also tried every available plugin I can find as well. No dice. I’m just not quite savvy enough understanding the relationship with the avia builder to work through this.

    Any suggestions?

    • This topic was modified 9 years ago by grooveva.
    #528633

    Hey grooveva!

    Try adding this to the bottom of your functions.php file.

    add_action( 'pre_get_posts', 'enfold_customization_archive_order', 50, 1 ); 
    function enfold_customization_archive_order( $query ){
        if ( $query->is_archive() ) {
            $query->set( 'order', 'ASC' );
        }
        return $query;
    }
    

    Cheers!
    Elliott

    #528983

    I gave that a go as you can see in my child theme but no luck with that.

    #529666

    Just following up, the suggested code definitely doesn’t work. As is everyone on the forums no doubt, we are anxious to get this to our end client but we can’t deliver until we come up with a solution.

    • This reply was modified 9 years ago by grooveva.
    #530268

    Hi!

    Can you please try following code

    add_filter( 'pre_get_posts', 'enfold_customization_archive_order' );
    function enfold_customization_archive_order( $query ) {
    	 if ( $query->is_archive() ) {
    		$query->set('order', 'ASC');
    		$query->set('orderby', 'modified');
    	}
    }

    Best regards,
    Yigit

    #530398

    No change at all unfortunately. I’m including my site logins again below.

    #530594

    Hey!

    We tried to login to the site but it’s not working. Please check. Replace the code with this:

    add_action( 'pre_get_posts', 'pre_get_posts_post' );
    function pre_get_posts_post( $query ) {
    	if( $query->is_archive() ) {
    		$query->set('orderby', array('title' => 'ASC'));
    	}
        return $query;
    }

    Works on our installation.

    Best regards,
    Ismael

    #530606

    Yeah something must be conflicting I’ve reset your temp admin password see below. I’d wager it’s the custom code for the avia builder to alphabetize post output that’s borking these attempts but I’m not savvy enough to prove it.

    • This reply was modified 9 years ago by grooveva.
    #530651

    Hi!

    The code works OK on our installation but it doesn’t seem to be doing anything when we added it in your functions.php file. What happens if you disable the archive.php file in the child theme folder?

    Regards,
    Ismael

    #530661

    no change so I suppose it’s safe to say the custom archive page isn’t the culprit.

    #531723

    Hi!

    Please try to deactivate all plugins then hard refresh the page.

    Cheers!
    Ismael

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