Order Portfolio Alphabetically

Home Forums Dzen WordPress Theme Order Portfolio Alphabetically

This topic contains 9 replies, has 2 voices, and was last updated by  ab-themes 8 years, 2 months ago.

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #14050

    osmondc
    Participant

    I need to be able to order the portfolio categories and tiles alphabetically (The default order seems to be by edit date?). What change is required to achieve this? Thanks in advance.

    #14066

    ab-themes
    Keymaster

    Hi there,

    unfortunately, wordpress doesn’t have a possibility to order the categories, but to change order of posts in portfolio
    the easiest way would be to change the post date of your items.

    Kind regards

    #14095

    osmondc
    Participant

    Are you able to confirm how the portfolio categories and tiles are ordered, specifically in the Creator element so I know exactly how I can manipulate the categories to get them in the correct order if it isn’t possible to sort them at a code level. Thanks

    #14150

    ab-themes
    Keymaster

    Hi,

    they are ordered from Z to A.

    You can see that when you go here

    http://preview.magnior.com/dzen/

    Scroll to portfolio section and hover on each image.

    It starts with “Sky Idyll”(S) and ends with “Lake heaven”(L).

    I hope this help you :)

    Kind regards

    #14177

    osmondc
    Participant

    This is not what I see on our own site, the order of the categories changes every time a portfolio, the category that portfolio belongs to or category itself is edited. Please verify the behaviour of the Creator Element and let me know what the expected behaviour is (that I am able to replicate.

    #14209

    ab-themes
    Keymaster

    Ok, we sent this to our developers and they answered us that you can sort portfolios alphabetically with adding this code:

    'orderby' => 'title',
    'order' => 'ASC',

    inside wp-content\themes\dzen\page-portfolio-4columns.php file.
    Just find this code:

    $args = array(
    	'post_type' => 'portfolio',
    	'portfolio-category' => $selected_categories,
    	'posts_per_page'=>-1,
    );

    and replace it with this one:

    $args = array(
    	'post_type' => 'portfolio',
    	'portfolio-category' => $selected_categories,
    	'posts_per_page'=>-1,
    	'orderby' => 'title',
    	'order' => 'ASC',
    );

    this will sort your portfolios alphabetically.

    Best Regards

    #14237

    osmondc
    Participant

    This fixes the sort order of the Portfolio tiles on a separate page, but has no impact on the order of the tiles on the home page (Creator Element). What additional code is required to correct it for this as well?

    Also what code can be added to also force the categories to sort in the same way as the change above has no impact on categories.

    #14248

    ab-themes
    Keymaster

    Sort order for the Creator Element (portfolio):
    The tiles sort:
    – go to the file: wp-content\plugins\abdev-portfolio\shortcode.php
    – find this code:
    $query='post_type=portfolio&posts_per_page='.$count.$cat;
    and replace it with this one:
    $query='post_type=portfolio&orderby=title&order=ASC&posts_per_page='.$count.$cat;

    The categories sort:
    – same file: wp-content\plugins\abdev-portfolio\shortcode.php
    – find this code:

    if(isset($filter_slugs) && is_array($filter_slugs)){
    	foreach($filter_slugs as $slug => $name){
    		$filter_out.='<li><a href="#filter" data-option-value=".'.$slug.'">'.$name.'</a></li>';
    	}
    }

    and replace it with this one:

    if(isset($filter_slugs) && is_array($filter_slugs)){
    	ksort($filter_slugs);
    	foreach($filter_slugs as $slug => $name){
    		$filter_out.='<li><a href="#filter" data-option-value=".'.$slug.'">'.$name.'</a></li>';
    	}
    }

    For sorting categories on a separate page:
    – go to wp-content\themes\dzen\page-portfolio-4columns.php
    – find this code:

    if(isset($filter_slugs) && is_array($filter_slugs)){
    	foreach($filter_slugs as $slug => $name){
    		$filter_out .= '<li><a href="#filter" data-option-value=".'.$slug.'">'.$name.'</a></li>';
    	}
    }

    and replace it with this one:

    if(isset($filter_slugs) && is_array($filter_slugs)){
    	ksort($filter_slugs);
    	foreach($filter_slugs as $slug => $name){
    		$filter_out .= '<li><a href="#filter" data-option-value=".'.$slug.'">'.$name.'</a></li>';
    	}
    }

    This should be it.

    Best Regards

    #14352

    osmondc
    Participant

    That worked perfectly thanks for your assistance.

    #14369

    ab-themes
    Keymaster

    No problem, glad that we could help :)

    Cheers

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

The topic ‘Order Portfolio Alphabetically’ is closed to new replies.