Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi there. ??

    There is absolutely a way to get your projects to display in a random order but it will take a few steps and some comfort with HTML/basic PHP.

    As a starting point, you should set up a child theme. The following guides give good introductions to child themes, including steps to set them up:

    https://codex.www.ads-software.com/Child_Themes

    After you have set your child theme up, copy the page-templates/portfolio-page.php file from the parent theme to your child’s directory.

    Next, open up the new file in your child theme’s directory in your favourite text or code editor.

    $args = array(
    	'post_type'      => 'jetpack-portfolio',
    	'paged'          => $paged,
    	'posts_per_page' => $posts_per_page,
    );

    To order your portfolio items in a random order, we need to add the following to this list of arguments:

    'orderby' => rand,

    The updated snippet of code will look as follows in your child theme:

    $args = array(
    	'post_type'      => 'jetpack-portfolio',
    	'paged'          => $paged,
    	'posts_per_page' => $posts_per_page,
    	'orderby'		 => rand,
    );

    In case you’d like some more explanation about what we’re editing here: The arguments are passed to a class called WP_Query, which you can read more about on this Codex page:

    https://codex.www.ads-software.com/Class_Reference/WP_Query

    Let me know how you get on with that or if any extra questions come up.

    Jetpack portfolio shortcode has attribute orderby that can have values date, title, author and rand (https://en.support.wordpress.com/portfolios/portfolio-shortcode/#attributes). I’m using theme twentysixteen, attribute title works, rand doesn’t. Why?

    Hi @andywar65,

    I tested the following shortcode on my own installation of Twenty Sixteen and it did randomise the order of my portfolio items on the page:

    [portfolio orderby=rand]

    If the shortcode is still not working correctly for you, please try contacting Jetpack directly via their contact form. In your support request, include a link to your portfolio page and information about the exact shortcode you tried. It would also be helpful for them to know if you can replicate the issue across different themes or if the issue is only with Twenty Sixteen.

    As an extra note: This sub forum is specifically for questions surrounding the Espied theme. For future, please either post to the specific sub forum for the theme you’re using or one of the general www.ads-software.com sub forums. (Whichever’s most relevant to your question.) We also try to keep separate questions to separate threads on this forum. This makes it easier for those helping to keep track.

    Thanks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Display Projects on Homepage in Random Order’ is closed to new replies.