Ordering my portfolio???

(39 posts) (13 voices)

  1. Hi my site is

    http://www.robgraphics.co.uk/

    I want to be able to order my portfolio as it is a key part to my site as i am a graphic designer, is this possible?

    I cant seem to find an option to do so :s

    Thanks

    Posted 6 years ago #
  2. Elliott
    Support

    Hello robgraphics,

    You can order by id, title, date, and a few other options. See here for more info, http://codex.wordpress.org/Class_Reference/WP_Query.

    Open up /wp-content/themes/infocus/lib/shortcodes/15-portfolio.php and on lines 121 - 142 you should see this,

    if( strpos( $disable, 'pagination' ) === false ) {
    
    	$portfolio_query->query(array(
    		'post_type' => 'portfolio',
    		'posts_per_page' => $showposts,
    		'taxonomy' => 'portfolio_category',
    		'term' => $cat,
    		'offset' => $offset,
    		'paged' => $paged
    	));
    
    } else {
    
    	$portfolio_query->query(array(
    		'post_type' => 'portfolio',
    		'showposts' => $showposts,
    		'taxonomy' => 'portfolio_category',
    		'term' => $cat,
    		'offset' => $offset,
    		'nopaging' => 0
    	));
    }

    And as an example we are going to order it by title from A-Z.

    if( strpos( $disable, 'pagination' ) === false ) {
    
    	$portfolio_query->query(array(
    		'post_type' => 'portfolio',
    		'posts_per_page' => $showposts,
    		'taxonomy' => 'portfolio_category',
    		'term' => $cat,
    		'offset' => $offset,
    		'paged' => $paged,
    		'orderby' => 'title',
    		'order' => 'ASC',
    	));
    
    } else {
    
    	$portfolio_query->query(array(
    		'post_type' => 'portfolio',
    		'showposts' => $showposts,
    		'taxonomy' => 'portfolio_category',
    		'term' => $cat,
    		'offset' => $offset,
    		'nopaging' => 0,
    		'orderby' => 'title',
    		'order' => 'ASC',
    	));
    }
    Posted 6 years ago #
  3. Is there a way i can upload all the images to my portfolio then go through them and put them in an order that i choose?

    I dont really want them in order of date or in alphabetical, but i would like to mix all the projects up a bit

    Would this be too tricky?

    Posted 6 years ago #
  4. Elliott
    Support

    I think you should be able to do it by using custom fields,

    $portfolio_query->query(array(
    	'post_type' => 'portfolio',
    	'posts_per_page' => $showposts,
    	'taxonomy' => 'portfolio_category',
    	'term' => $cat,
    	'offset' => $offset,
    	'paged' => $paged,
    	'meta_key' => 'portfolio_order',
    	'orderby' => 'meta_value_num',
    	'order' => 'ASC',
    ));

    And then in each portfolio item add a custom field with a name of "portfolio_order" and a numeric value from 0 - infinity.

    It would probably be better if you used our fancy_images shortcode to have complete control over your page, http://mysitemyway.com/docs/index.php?title=Fancy_Images.

    You can combine all of our shortcodes to create any type of page that you want.

    Posted 6 years ago #
  5. Sorry Elliott you are explaining this well, im just a total noob

    Could you explain a little more about the custom fields option possibly?

    Where would i insert that text and where would i number each individual project?

    Thank you

    Posted 6 years ago #
  6. Elliott
    Support

    Sorry, first off open up /wp-content/themes/infocus/lib/functions/theme.php and around line 375 you should see this,

    'supports' => array('title', 'editor', 'excerpt', 'thumbnail', 'comments' )

    Change it like this,

    'supports' => array('title', 'editor', 'excerpt', 'thumbnail', 'comments', 'custom-fields' )

    Now you can set custom fields in your portfolio items. When editing a portfolio item click on "Screen Options" in the top right hand corner of your screen and make sure "Custom Fields" is checked.

    Scroll down your page and add a new custom field with a name of "portfolio_order" and a value between 1 - 100. (1 coming first and 100 coming last)

    You'll need to do this for each portfolio item, the ones that do not have a custom field will not display.

    If you haven't done so already here is what lines 121 - 142 should look like in /wp-content/themes/infocus/lib/shortcodes/15-portfolio.php

    if( strpos( $disable, 'pagination' ) === false ) {
    
    	$portfolio_query->query(array(
    		'post_type' => 'portfolio',
    		'posts_per_page' => $showposts,
    		'taxonomy' => 'portfolio_category',
    		'term' => $cat,
    		'offset' => $offset,
    		'paged' => $paged,
                    'meta_key' => 'portfolio_order',
             	'orderby' => 'meta_value_num',
    	        'order' => 'ASC',
    	));
    
    } else {
    
    	$portfolio_query->query(array(
    		'post_type' => 'portfolio',
    		'showposts' => $showposts,
    		'taxonomy' => 'portfolio_category',
    		'term' => $cat,
    		'offset' => $offset,
    		'nopaging' => 0,
                    'meta_key' => 'portfolio_order',
              	'orderby' => 'meta_value_num',
            	'order' => 'ASC',
    	));
    }
    Posted 6 years ago #
  7. That has worked

    Absolutely fantastic!!!

    I cant tell you how impressed i am!!

    Thank you so much

    Posted 6 years ago #
  8. FYI: This plugin seems to work well for this: Post Types Order (http://wordpress.org/extend/plugins/post-types-order/)

    Posted 6 years ago #
  9. Elliott
    Support

    If your using the [portfolio_list] shortcode then you also need to do the changes on lines 461 - 468 in /wp-content/themes/[your_theme]/lib/shortcodes/15-portfolio.php.

    Posted 6 years ago #
  10. Elliott
    Support

    In the latest versions the code is a little bit different but you'll want to change lines 133 - 165 to this,

    if( strpos( $disable, 'pagination' ) === false ) {
    
    	$portfolio_query->query(array(
    		'post_type' => 'portfolio',
    		'posts_per_page' => $showposts,
    		'tax_query' => array(
    			'relation' => 'IN',
    			array(
    				'taxonomy' => 'portfolio_category',
    				'field' => 'slug',
    				'terms' => explode(',', $cat)
    			)
    		),
    		'offset' => $offset,
    		'paged' => $paged,
    		'meta_key' => 'portfolio_order',
    		'orderby' => 'meta_value_num',
    		'order' => 'ASC',
    	));
    
    } else {
    
    	$portfolio_query->query(array(
    		'post_type' => 'portfolio',
    		'posts_per_page' => $showposts,
    		'tax_query' => array(
    			'relation' => 'IN',
    			array(
    				'taxonomy' => 'portfolio_category',
    				'field' => 'slug',
    				'terms' => explode(',', $cat)
    			)
    		),
    		'offset' => $offset,
    		'nopaging' => 0,
    		'meta_key' => 'portfolio_order',
    		'orderby' => 'meta_value_num',
    		'order' => 'ASC',
    	));
    Posted 5 years ago #
  11. I just added this code to have my portfolios list alphabetically and now none of my portfolio posts are showing on the grid view....it says "No portfolio posts were found for the category selected." Although, they are still showing in the correct categories in the portfolio management page.

    The only change I made was to this code and one moment they were here, the next they were gone... :(

    Posted 5 years ago #
  12. Elliott
    Support

    See my previous post for the changes needed in the latest versions of our framework.

    Posted 5 years ago #
  13. disregard. I had to add the custom fields. I did and if solved the issue. Thanks!

    Posted 5 years ago #
  14. studiocj
    Member

    Hi. Picking up on this issue of ordering PORTFOLIO LISTS & GRIDS with numerical values.

    I'm using METHOD and the code is slightly different - kind of double sections. From Line 136:

    if( strpos( $disable, 'pagination' ) === false ) {

    if( !empty( $cat ) )
    {
    $portfolio_query->query(array(
    'post_type' => 'portfolio',
    'posts_per_page' => $showposts,
    'tax_query' => array(
    'relation' => 'IN',
    array(
    'taxonomy' => 'portfolio_category',
    'field' => 'slug',
    'terms' => explode(',', $cat)
    )
    ),
    'offset' => $offset,
    'paged' => $paged,
    ));

    }
    else
    {
    $portfolio_query->query(array(
    'post_type' => 'portfolio',
    'posts_per_page' => $showposts,
    'offset' => $offset,
    'paged' => $paged,
    ));
    }

    } else {

    if( !empty( $cat ) )
    {
    $portfolio_query->query(array(
    'post_type' => 'portfolio',
    'posts_per_page' => $showposts,
    'tax_query' => array(
    'relation' => 'IN',
    array(
    'taxonomy' => 'portfolio_category',
    'field' => 'slug',
    'terms' => explode(',', $cat)
    )
    ),
    'offset' => $offset,
    'nopaging' => 0,
    ));

    }
    else
    {
    $portfolio_query->query(array(
    'post_type' => 'portfolio',
    'posts_per_page' => $showposts,
    'offset' => $offset,
    'nopaging' => 0,
    ));

    There is a similar code structure from Line 512.

    Would you be able to help with the relevant amendments for both GRID & LIST PORTFOLIO order numbering.

    Thanks!

    Posted 5 years ago #
  15. studiocj
    Member

    Sorry, I'm attaching a screenshot which is maybe clearer.

    Attachments

    1. Screen_Shot_2012-08-17_at_16.11.45.png (95.1 KB, 3 downloads) 5 years old
    Posted 5 years ago #
  16. Elliott
    Support

    See my previous post, http://mysitemyway.com/support/topic/ordering-my-portfolio#post-47221, for the code in latest versions.

    Posted 5 years ago #
  17. studiocj
    Member

    Sorry but it isn't clear to me what to do. In the METHOD code there are two blocks of code that end with PAGED then two blocks of code that end in NOPAGING.

    In your example there are only two blocks of relevant code. The first ends in PAGED, after which you insert the new 3 lines, the second block ends in NOPAGE, after which you insert the 3 lines again. Thus you have inserted the extra 3 lines twice .

    In the case of METHOD, do I add these three lines in four different places?

    Does this make any sense? Hope so.

    Posted 5 years ago #
  18. Elliott
    Support

    Yes, all 4 places.

    Posted 5 years ago #
  19. capnhairdo
    Member

    This makes no sense. I have to hack up the theme code in order to get my portfolio items to appear in a certain order?

    Portfolio items are simply a special type of post, saved in WordPress' "posts" table. This table already has a field for the "menu_order" which is used to allow regular posts and pages to be ordered arbitrarily. Anybody who has used WordPress is familiar with this feature.

    It seems like an oversight on your part to have not included this field for ordering portfolio items. This should be fixed, rather than instructing your customers to implement custom fields and hack up PHP theme files...especially since the latter would be overwritten and lost whenever a theme is upgraded.

    I tried the Post Types Order plug-in, and it seems to work fine, so I guess I'll stick with that for now.

    Posted 5 years ago #
  20. Elliott
    Support

    That's for doing a "custom" order.

    If you want to use the menu order field then change this line,

    'orderby' => 'title',

    To this,

    'orderby' => 'menu_order',

    To get the menu order field to display in our portfolio post types then open up /wp-content/themes/[your_theme]/lib/functions/theme.php and change line 566 from this,

    'supports' => array('title', 'editor', 'excerpt', 'thumbnail', 'comments' )

    To this,

    'supports' => array('title', 'editor', 'excerpt', 'thumbnail', 'comments', 'page-attributes' )

    Posted 5 years ago #
  21. capnhairdo
    Member

    Thanks, Elliott. I actually just figured out that exact solution and was about to post it here, when I found that you already had.

    Given that this is the field that WordPress uses internally to sort posts and pages, this seems like the least hacked-up way to sort portfolio items, and the most intuitive for experienced WordPress users.

    I suppose some people would still prefer to sort by things like title. Perhaps you could add a parameter to the portfolio shortcode that allows people to specify whether they'd like to manually set the order or have it sorted automatically by title or date.

    FYI, the plug-in mentioned above seems to use WordPress' built-in menu_order field, so you can implement the hack above AND use that plug-in together, if you like. But the nice thing about the plug-in is that it automatically makes the code edits necessary to enable it to work, so no hacks to the theme are necessary.

    Posted 5 years ago #
  22. Elliott
    Support

    We will be adding a "custom" option to our portfolio and blog shortcodes in the future where you can add custom queries to do stuff like this.

    Posted 5 years ago #
  23. joriskangeri
    Member

    Hi Elliott, at the moment I'm looking at this very issue (custom ordering) - do you know if the custom option/shortcodes have been added yet? Looking at the code snippets you've posted above - they seem to be a little different from the code currently in the 15-portfolio.php file of the inFocus theme.

    Appreciate your help. Thanks.

    Posted 4 years ago #
  24. Elliott
    Support

    It hasn't but you can do the above. It's not working for you?

    Posted 4 years ago #
  25. joriskangeri
    Member

    Haven't tried yet. When I checked the codes seemed different (e.g. line numbers didn't correspond), so I didn't want to start messing around with it without checking with you. The theme I'm using is inFOcus.

    Posted 4 years ago #
  26. Elliott
    Support

    The line numbers may be a tad off in the latest version but it's still the same code.

    Posted 4 years ago #
  27. joriskangeri
    Member

    Ok, I'll give it go, thanks. Keep you posted.

    Posted 4 years ago #
  28. joriskangeri
    Member

    I elected to use the plugin that DigitalTactics mentioned above - works fantastic. Thanks.

    Posted 4 years ago #
  29. lolitasmith
    Member

    I'm having trouble sorting my portfolios in the order that I want then to post. I tried following these directions, but when I edit the PHP code, I get the following error when I try to add a new post:

    Parse error: syntax error, unexpected ';', expecting T_FUNCTION in /home/content/20/9050820/html/wp-content/themes/fusion/lib/shortcodes/15-portfolio.php on line 1264

    I just purchased the Fusion theme. Please help. Thank you.

    Posted 4 years ago #
  30. Elliott
    Support

    Your doing the edits wrong. Go ahead and use the plugin that everyone else is using to make it easier.

    Posted 4 years ago #
  31. Hi,

    I'm also trying to do this. Have successfully added the custom fields option in but when I try to change the 15-Portfolio.php file the whole portfolio page goes down. I'm using the latest version of Construct and as you say, the line numbers have changed slightly, coming up as 136-164 but it really isn't working.

    Can you help?

    Thanks

    Posted 4 years ago #
  32. Elliott
    Support

  33. dmitchelldesign
    Member

    I tried to update the 15-portfolio.php file before I read all the way to the bottom of this and saw the plugin. However, I duplicated that file just so if I broke anything I could just put it back, but even after replacing the file with the original my site is still broken and getting this error. Any ideas on why? Thank you

    Fatal error: Cannot redeclare class mysitePortfolio in /nfs/c10/h03/mnt/145635/domains/nemoarms.com/html/wp-content/themes/infocus/lib/shortcodes/15-portfolio.php on line 5

    Posted 4 years ago #
  34. Elliott
    Support

    Try completely deleting the theme before downloading / uploading a fresh copy.

    Posted 4 years ago #
  35. bitkahuna
    Member

    "simple custom post order" plugin is wonderful - drag and drop to order any posts!

    Posted 3 years ago #
  36. Hi
    I want to show certain portfolios in grid layout by id !!
    I just re-installed my favorite theme InFocus - LOVE the new version!
    But I came from another theme that had a super way of selecting what portfolio items to include based on it's ID

    So the code (with options) would look like this:
    [entries ids="3037,3042,3142,3046,3050,3062,3094" column_size="full" heading_tag="auto" heading_position="above" show_featured_content="false" show_headings="true" show_meta_infos="false" show_excerpts="true" show_buttons="false" featured_image_link_method="lightbox"]

    I have a small plugin by WebShaks that shows ID on every post/page and portfolio.
    I have video pages, customer, testimonials and other stuff in my Portfolio...
    This way I can show each one - selected - where I want - whenever

    With InFocus ... I can only set how many... ??? Grumpf I have many...

    Please advise... Simply edit the order is not enuf for me!

    Posted 3 years ago #
  37. Elliott
    Support

    So you want to add an option to the portfolio shortcode to set an ID for a portfolio posts and only display that correct?

    I'll move this to feature requests and we'll take a look of adding this feature in a future update.

    Posted 3 years ago #
  38. Hi Elliott

    That is correct - Thanks!
    Adding more - comma separated.
    It could be added to the shortcode generator with the options that are available.

    Posted 3 years ago #
  39. sama55
    Member

    I have same issue.
    I fixed this issue with below hacks (Add "orderby" and "order" shortcode options).
    I'm happy when it comes to help someone.

    Source file: wp-content/themes/infocus/lib/shortcodes/15-portfolio.php

    Code Example:

    Part-1: (Note: There are 3 locations. Note the first comma (,) .)

    		extract(shortcode_atts(array(
    			'column' 	=> '4',
    			'showposts'	=> '8',
    			'cat' 		=> '',
    			'offset' 	=> '',
    			'disable'	=> ''
    			// Add [start]
    			,'orderby'	=> 'ID',
    			'order'	=> 'DESC',
    			// Add [end]
    		), $atts));

    Part-2: (Note: There are 10 locations.)

    		$portfolio_query->query(array(
    			'post_type' => 'portfolio',
    			'posts_per_page' => $showposts,
    			'tax_query' => array(
    				'relation' => 'IN',
    				array(
    					'taxonomy' => 'portfolio_category',
    					'field' => 'slug',
    					'terms' => explode(',', $cat)
    				)
    			),
    			'offset' => $offset,
    			'paged' => $paged,
    			// Add [start]
    			'orderby' => $orderby,
    			'order' => $order,
    			// Add [end]
    		));
    Posted 2 years ago #

Reply

You must log in to post.

Construct WordPress Theme
Construct wordpress theme
Myriad WordPress Theme
Myriad wordpress theme
Method WordPress Theme
Method wordpress theme
Fusion WordPress Theme
Fusion wordpress theme
Elegance WordPress Theme
Elegance wordpress theme
Echelon WordPress Theme
Echelon wordpress theme
Dejavu WordPress Theme
Dejavu wordpress theme
Modular WordPress Theme
Modular wordpress theme