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

    Hi All,

    Does anyone know of a simple way to resort the portfolio items alphabetically (by title) ?

    I’m guessing it would be an edit in the PHP loop for portfolio but didn’t want to risk breaking the theme.

    Any ideas welcome!

    Many Thanks

    Seth

    P.S. Also, is there any way to run a separate sort as random?

    #88045

    Hi,

    Open includes > helper-template-logic.php and find this code under avia_set_portfolio_query() function.

    $avia_config['new_query'] = array(	'orderby' 	=> 'ID',
    'order' => 'ASC',
    'paged' => get_query_var( 'paged' ),
    'posts_per_page' => $itemcount,
    'tax_query' => array( array( 'taxonomy' => 'portfolio_entries',

    Change order from ASC to DESC, random. You can also visit http://codex.wordpress.org/Class_Reference/WP_Query#Order_.26_Orderby_Parameters for more options.

    Cheers,

    Ismael

    #88046

    Hello,

    I would like to second this request. I’m using Coherence as well.

    I’ve tried the suggestion above – going into the editor in WordPress, modifying the helper-template-logic.php file as noted and updating the file. Doesn’t work, it still sorts by ID.

    If I could change the ID, that might help. But, it would be best if I could just have the portfolio items sort alphabetically by title.

    Thanks!

    #88047

    Add following code to the bottom of functions.php:

    function loop_portfolio_query( $location )
    {
    if ( $location == 'loop-portfolio' )
    {
    global $avia_config;
    if(isset($avia_config['new_query'])) {
    $avia_config['new_query']['orderby'] = "title";
    $avia_config['new_query']['order'] = "ASC";
    query_posts($avia_config['new_query']);
    }
    }
    }
    add_action( 'avia_action_query_check' , 'loop_portfolio_query', 10, 1 );

    You can replace ASC with DESC for a descending order.

    If you want to sort a certain portfolio page by using the “random” parameter try following code. Instead of 15 insert your portfolio page id (which should display the items/entries in a random order).

    function loop_portfolio_query( $location )
    {
    if ( $location == 'loop-portfolio' )
    {
    global $avia_config;
    if(isset($avia_config['new_query'])) {
    $avia_config['new_query']['orderby'] = "title";
    $avia_config['new_query']['order'] = "ASC";

    if(is_page('15'))
    {
    $avia_config['new_query']['orderby'] = "rand";
    }
    query_posts($avia_config['new_query']);
    }
    }
    }
    add_action( 'avia_action_query_check' , 'loop_portfolio_query', 10, 1 );

    #88048

    A mighty thanks to you both for the easy workarounds! That custom page ID sort will prove to be VERY helpful!

    Cheers

    Seth

Viewing 5 posts - 1 through 5 (of 5 total)

The topic ‘Coherence Portfolio Sort by Title’ is closed to new replies.