Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • #370871

    Hi Kriei Support!

    I’m trying to change the sorting order in the archive pages for portfolio categories. I’d like them to display according to date modified, in descending order, but I can’t seem to get it to work by adding ‘orderby’ -> ‘modified’ and ‘order’ => ‘DESC’ to the $atts = array in archive.php. I tried adding the same two bits to the array in taxonomy_portfolio-entries.php, but it’s also a no-go.

    is there another or a different file that I need to edit? Any help is appreciated. Thank you! Happy Holidays, Kriesi Support!

    #371135
    #371711

    Hi Andy,

    I just went into my theme folder, and the loop file that is referenced in the post your linked me to doesn’t exist. loop-portfolio-single.php is the closest thing I see, but the lines of code mentioned in the linked post aren’t there.

    #371734

    It looks like the post that’s referenced is the for the Angular theme, and not Enfold.

    #371850

    Hey!

    Try this plugin out, https://wordpress.org/plugins/post-types-order/, and let us know if it works for you.

    They also have a similar plugin for categories, https://wordpress.org/plugins/taxonomy-terms-order/.

    Cheers!
    Elliott

    • This reply was modified 9 years, 11 months ago by Elliott.
    #371928

    Manual re-ordering works, but automatic order does not. I’m trying to have it re-order automatically. Is this just not possible to achieve through enfold’s theme files?

    #372163

    Hey!

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

    add_filter( 'pre_get_posts', 'angular_customization_portfolio_order' );
    function angular_customization_portfolio_order( $q ) {
    	if ( $q->query_vars['post_type'] == 'portfolio' ) {
    		$q->set('order', 'DESC');
    		$q->set('orderby', 'modified');
    	}
    }

    Best regards,
    Elliott

    #372230

    Hi Elliot,

    I added your code to the bottom of the child theme’s functions.php file and it’s still a no go. I’d already changed those items in the $atts array and in archive.php and taxonomy-portfolio-categories to ‘DESC’ and ‘modified’, with no effect. I’ve been playing around with it a little more, and it seems like none of the orderby parameters are having any effect on the order in which the portfolio entries are being displayed. Is it possible that there’s a default setting being implemented somewhere else that’s preventing changes to the arrays in archive.php and taxonomy-portfolio-categories.php from taking effect?

    Regards,
    Scott

    #372246

    Hey!

    Hmm, it seems to be working fine on my XAMPP setup. Try uploading a fresh copy of the theme and then add that code back into the functions.php file.

    Also be sure to deactivate all plugins while testing.

    Best regards,
    Elliott

    • This reply was modified 9 years, 11 months ago by Elliott.
    #372278

    Elliot,

    I’m testing on a local copy in MAMP. I loaded a fresh instance of Enfold, updated it to the most current version (3.04), and disabled all plugins. It still isn’t having any effect.

    Should I be updated to WordPress 4.1 (I’m running 4.01)? I’ve been holding been holding off until the plugins I’m using are verified to work.

    Does it present a problem if the portfolio categories that are being used for the archives have subcategories? In most instances, there are two layers of subcategories, as below:

    Portfolio Category A
    -> Subcategory A
    -> Sub-subcategory A
    -> Sub-subcategory B
    -> Subcategory B
    -> Sub-subcategory A
    -> Sub-subcategory B
    Portfolio Category B
    -> Subcategory A
    -> Sub-subcategory A
    -> Sub-subcategory B
    -> Subcategory B
    -> Sub-subcategory A
    -> Sub-subcategory B

    Thanks for all the help!

    Regards,
    Scott

    #372301

    Hey!

    No that should not matter. Yes, make sure everything is updated.

    Best regards,
    Elliott

    #372335

    Elliot,

    I’ve updated to 4.1 and still no change. I added a column in admin to display the date modified for portfolio items and on the “Portfolio Items” admin page, the items are displaying in the correct order, but the changes aren’t extending to the taxonomy/archive pages.

    Is there any additional information I can supply you with that might help figure this out?

    Regards,
    Scott

    #372344

    Elliot,

    I think I’ve figured it out:

    I changed to code you have me from:

    add_filter( 'pre_get_posts', 'angular_customization_portfolio_order' );
    function angular_customization_portfolio_order( $q ) {
    	if ( $q->query_vars['post_type'] == 'portfolio' ) {
    		$q->set('order', 'DESC');
    		$q->set('orderby', 'modified');
    	}
    }

    to:

    add_filter( 'pre_get_posts', 'angular_customization_portfolio_order' );
    function angular_customization_portfolio_order( $q ) {
    	if ( $q->is_archive ) {
    		$q->set('order', 'DESC');
    		$q->set('orderby', 'modified');
    	}
    }

    Thanks for all of you help, Elliot–I appreciate it! Happy Holidays!

    Regards,
    Scott

Viewing 13 posts - 1 through 13 (of 13 total)
  • The topic ‘Portfolio Category Archive Sorting’ is closed to new replies.