I was searching for a random portfolio function like this for a while now.
Using your method, I am only having one problem:
Some of the portfolio items are now showing up twice within one category. What I read so far, this has to do with the pagination I am using within my portfolio. To avoid those duplicates while using pagination, I obviously need to somehow implement post id's and the "post__not_in" function:
I'll leave this ticket open in case Michele has a chance to respond - but for now I personally can't provide further assistance on this until it becomes a feature within the theme itself
I wanted my Portfolio to sort alphabetically by default. I found this post and used Michele\'s tip and expanded upon it to get what I wanted.
Again, as Michele pointed out - Go to /wp-content/themes/salient/nectar/tinymce/shortcode-processing.php - I am using Salient v 6.1.2, (which has more code them when Michele posted), so look for this fix around line 1173 and simply add this code in to the portfolio array.
\'orderby\' => \'title\',
\'order\' => \'ASC\',
You are adding two extra parameters that allow to to sort on TITLE in ASCENDING order. If you wanted to sort it in DESCENDING order simply replace the ASC with DSC in my example below. Hope it helps :-)
It worked great but I have a slight issue. I'm using the module in two places. For the home page instance I would like it to show the latest items. For the portfolio page I want it random. Is there any way to control for different sorts in different instances of the module?
Wish there was a way to accomplish two different sorts.
Is there a way for the default portfolio display be sorted randomly?
Hey Katie!
I am afraid we dont have such an option in Salient theme.
Thanks
ThemeNectar Support Team
Go to /wp-content/themes/salient/nectar/tinymce/shortcode-processing.php
Find around line 1095
$portfolio_arr = array(
'posts_per_page' => $posts_per_page,
'post_type' => 'portfolio',
'project-type'=> $category,
'paged'=> $paged
);
change with:
$portfolio_arr = array(
'posts_per_page' => $posts_per_page,
'post_type' => 'portfolio',
'project-type'=> $category,
'orderby' => 'rand',
'paged'=> $paged
);
Hey Michele!
Thanks for posting the hack.
Best,
-T
ThemeNectar Support Team
Thanks for this hack :-)
I was searching for a random portfolio function like this for a while now.
Using your method, I am only having one problem:
Some of the portfolio items are now showing up twice within one category.
What I read so far, this has to do with the pagination I am using within my portfolio.
To avoid those duplicates while using pagination, I obviously need to somehow implement
post id's and the "post__not_in" function:
https://wordpress.org/support/topic/order-by-rand-...
The only problem: I got no idea how to implement his :-/
Any chance someone could help on this?
Thanks in advance,
Philipp
Hey Philipp,
I'll leave this ticket open in case Michele has a chance to respond - but for now I personally can't provide further assistance on this until it becomes a feature within the theme itself
Thank you for all your time and efforts! I am really appreciating it and looking forward to future releases :-)
I wanted my Portfolio to sort alphabetically by default. I found this post and used Michele\'s tip and expanded upon it to get what I wanted.
Again, as Michele pointed out - Go to /wp-content/themes/salient/nectar/tinymce/shortcode-processing.php - I am using Salient v 6.1.2, (which has more code them when Michele posted), so look for this fix around line 1173 and simply add this code in to the portfolio array.
\'orderby\' => \'title\',
\'order\' => \'ASC\',
You are adding two extra parameters that allow to to sort on TITLE in ASCENDING order. If you wanted to sort it in DESCENDING order simply replace the ASC with DSC in my example below. Hope it helps :-)
$portfolio_arr = array(
\'posts_per_page\' => $posts_per_page,
\'post_type\' => \'portfolio\',
\'project-type\'=> $category,
\'orderby\' => \'title\',
\'order\' => \'ASC\',
\'paged\'=> $paged
);
So I added..
'orderby' => 'rand',
It worked great but I have a slight issue. I'm using the module in two places. For the home page instance I would like it to show the latest items. For the portfolio page I want it random. Is there any way to control for different sorts in different instances of the module?
Wish there was a way to accomplish two different sorts.