<?xml version="1.0" encoding="UTF-8"?>
	<rss version="2.0"
		xmlns:content="http://purl.org/rss/1.0/modules/content/"
		xmlns:wfw="http://wellformedweb.org/CommentAPI/"
		xmlns:dc="http://purl.org/dc/elements/1.1/"
		xmlns:atom="http://www.w3.org/2005/Atom"

			>

	<channel>

		<title>Random display of Portfolio &#8211; Themeco Community</title>
		<atom:link href="https://theme.co/archive/forums/topic/random-display-of-portfolio/feed/" rel="self" type="application/rss+xml" />
		<link>https://theme.co/archive/forums/topic/random-display-of-portfolio/feed/</link>
		<description></description>
		<lastBuildDate>Mon, 24 Nov 2025 21:33:15 +0000</lastBuildDate>
		<generator>https://bbpress.org/?v=2.6.14</generator>
		<language>en-US</language>

		
														
					
				<item>
					<guid>https://theme.co/archive/forums/topic/random-display-of-portfolio/#post-141521</guid>
					<title><![CDATA[Random display of Portfolio]]></title>
					<link>https://theme.co/archive/forums/topic/random-display-of-portfolio/#post-141521</link>
					<pubDate>Mon, 10 Nov 2014 09:29:13 +0000</pubDate>
					<dc:creator>danielmoutou</dc:creator>

					<description>
						<![CDATA[
						<p>Hello X Generation! 🙂<br />
I have one more is-it-possible-question: is it possible… to randomly display the Portfolio items? I have the latest Ethos stack with WP 4.0 and I have set up a child theme.</p>
<p>Thank you for reading,<br />
Cheers,<br />
Daniel</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>https://theme.co/archive/forums/topic/random-display-of-portfolio/#post-141648</guid>
					<title><![CDATA[Reply To: Random display of Portfolio]]></title>
					<link>https://theme.co/archive/forums/topic/random-display-of-portfolio/#post-141648</link>
					<pubDate>Mon, 10 Nov 2014 13:18:55 +0000</pubDate>
					<dc:creator>Paul R</dc:creator>

					<description>
						<![CDATA[
						<p>Hi Daniel,</p>
<p>Thanks for writing in!</p>
<p>To randomly display the Portfolio items</p>
<p>Create file _index.php in wp-content\themes\x-child-ethos\framework\views\global<br />
and copy the code below into that file.</p>
<pre><code>
&lt;?php

// =============================================================================
// VIEWS/GLOBAL/_INDEX.PHP
// -----------------------------------------------------------------------------
// Includes the index output.
// =============================================================================

$stack = x_get_stack();

if ( is_home() ) :
  $style     = x_get_option( &#039;x_blog_style&#039;, &#039;standard&#039; );
  $cols      = x_get_option( &#039;x_blog_masonry_columns&#039;, &#039;2&#039; );
  $condition = is_home() &amp;&amp; $style == &#039;masonry&#039;;
elseif ( is_archive() ) :
  $style     = x_get_option( &#039;x_archive_style&#039;, &#039;standard&#039; );
  $cols      = x_get_option( &#039;x_archive_masonry_columns&#039;, &#039;2&#039; );
  $condition = is_archive() &amp;&amp; $style == &#039;masonry&#039;;
elseif ( is_search() ) :
  $condition = false;
endif;
if(is_post_type_archive( &#039;x-portfolio&#039; )){
global $query_string;
query_posts($query_string . &#039;&amp;orderby=rand&#039;);
}
?&gt;

&lt;?php if ( $condition ) : ?&gt;

  &lt;?php x_get_view( &#039;global&#039;, &#039;_script&#039;, &#039;isotope-index&#039; ); ?&gt;

  &lt;div id=&quot;x-iso-container&quot; class=&quot;x-iso-container x-iso-container-posts cols-&lt;?php echo $cols; ?&gt;&quot;&gt;

    &lt;?php if ( have_posts() ) : ?&gt;
      &lt;?php while ( have_posts() ) : the_post(); ?&gt;
        &lt;?php if ( $stack != &#039;ethos&#039; ) : ?&gt;
          &lt;?php x_get_view( $stack, &#039;content&#039;, get_post_format() ); ?&gt;
        &lt;?php else : ?&gt;
          &lt;?php x_ethos_entry_cover( &#039;main-content&#039; ); ?&gt;
        &lt;?php endif; ?&gt;
      &lt;?php endwhile; ?&gt;
    &lt;?php else : ?&gt;
      &lt;?php x_get_view( &#039;global&#039;, &#039;_content-none&#039; ); ?&gt;
    &lt;?php endif; ?&gt;

  &lt;/div&gt;

&lt;?php else : ?&gt;

  &lt;?php if ( have_posts() ) : ?&gt;
    &lt;?php while ( have_posts() ) : the_post(); ?&gt;
      &lt;?php x_get_view( $stack, &#039;content&#039;, get_post_format() ); ?&gt;
    &lt;?php endwhile; ?&gt;
  &lt;?php else : ?&gt;
    &lt;?php x_get_view( &#039;global&#039;, &#039;_content-none&#039; ); ?&gt;
  &lt;?php endif; ?&gt;

&lt;?php endif; ?&gt;

&lt;?php pagenavi(); ?&gt;
</code></pre>
<p>Create file _portfolio.php in wp-content\themes\x-child-ethos\framework\views\global<br />
and copy the code below into that file.</p>
<pre><code>
&lt;?php

// =============================================================================
// VIEWS/GLOBAL/_PORTFOLIO.PHP
// -----------------------------------------------------------------------------
// Includes the portfolio output.
// =============================================================================

$stack    = x_get_stack();
$entry_id = get_the_ID();
$paged    = ( is_front_page() ) ? get_query_var( &#039;page&#039; ) : ( ( get_query_var( &#039;paged&#039; ) ) ? get_query_var( &#039;paged&#039; ) : 1 );
$cols     = get_post_meta( $entry_id, &#039;_x_portfolio_columns&#039;, true );
$count    = get_post_meta( $entry_id, &#039;_x_portfolio_posts_per_page&#039;, true );
$filters  = get_post_meta( $entry_id, &#039;_x_portfolio_category_filters&#039;, true );

switch ( $cols ) {
  case &#039;One&#039;   : $cols = 1; break;
  case &#039;Two&#039;   : $cols = 2; break;
  case &#039;Three&#039; : $cols = 3; break;
  case &#039;Four&#039;  : $cols = 4; break;
}

?&gt;

&lt;?php x_get_view( &#039;global&#039;, &#039;_script&#039;, &#039;isotope-portfolio&#039; ); ?&gt;

&lt;div id=&quot;x-iso-container&quot; class=&quot;x-iso-container x-iso-container-portfolio cols-&lt;?php echo $cols; ?&gt;&quot;&gt;

  &lt;?php

  if ( count( $filters ) == 1 &amp;&amp; in_array( &#039;All Categories&#039;, $filters ) ) {

    $args = array(
      &#039;post_type&#039;      =&gt; &#039;x-portfolio&#039;,
      &#039;posts_per_page&#039; =&gt; $count,
      &#039;paged&#039;          =&gt; $paged,   
      &#039;orderby&#039;        =&gt; &#039;rand&#039;,
    );

  } else {

    $args = array(
      &#039;post_type&#039;      =&gt; &#039;x-portfolio&#039;,
      &#039;posts_per_page&#039; =&gt; $count,
      &#039;paged&#039;          =&gt; $paged,     
      &#039;orderby&#039;        =&gt; &#039;rand&#039;,  
      &#039;tax_query&#039;      =&gt; array(
        array(
          &#039;taxonomy&#039; =&gt; &#039;portfolio-category&#039;,
          &#039;field&#039;    =&gt; &#039;id&#039;,
          &#039;terms&#039;    =&gt; $filters
        )
      )
    );

  }

  $wp_query = new WP_Query( $args );

  ?&gt;

  &lt;?php if ( $wp_query-&gt;have_posts() ) : ?&gt;
    &lt;?php while ( $wp_query-&gt;have_posts() ) : $wp_query-&gt;the_post(); ?&gt;
      &lt;?php if ( $stack != &#039;ethos&#039; ) : ?&gt;
        &lt;?php x_get_view( $stack, &#039;content&#039;, &#039;portfolio&#039; ); ?&gt;
      &lt;?php else : ?&gt;
        &lt;?php x_ethos_entry_cover( &#039;main-content&#039; ); ?&gt;
      &lt;?php endif; ?&gt;
    &lt;?php endwhile; ?&gt;
  &lt;?php endif; ?&gt;

&lt;/div&gt;

&lt;?php pagenavi(); ?&gt;
&lt;?php wp_reset_query(); ?&gt;
</code></pre>
<p>Hope that helps. 🙂</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>https://theme.co/archive/forums/topic/random-display-of-portfolio/#post-141896</guid>
					<title><![CDATA[Reply To: Random display of Portfolio]]></title>
					<link>https://theme.co/archive/forums/topic/random-display-of-portfolio/#post-141896</link>
					<pubDate>Mon, 10 Nov 2014 17:32:54 +0000</pubDate>
					<dc:creator>danielmoutou</dc:creator>

					<description>
						<![CDATA[
						<p>It works beautifully, thank you so much! And at the same time, I can learn a few things by comparing the parent and the child files…<br />
Have a nice evening,</p>
<p>Cheers,<br />
Daniel</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>https://theme.co/archive/forums/topic/random-display-of-portfolio/#post-142034</guid>
					<title><![CDATA[Reply To: Random display of Portfolio]]></title>
					<link>https://theme.co/archive/forums/topic/random-display-of-portfolio/#post-142034</link>
					<pubDate>Mon, 10 Nov 2014 20:49:18 +0000</pubDate>
					<dc:creator>Cousett</dc:creator>

					<description>
						<![CDATA[
						<p>Glad we were able to help. 🙂 Have a nice day. </p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>https://theme.co/archive/forums/topic/random-display-of-portfolio/#post-377274</guid>
					<title><![CDATA[Reply To: Random display of Portfolio]]></title>
					<link>https://theme.co/archive/forums/topic/random-display-of-portfolio/#post-377274</link>
					<pubDate>Thu, 03 Sep 2015 02:10:58 +0000</pubDate>
					<dc:creator>theleoad</dc:creator>

					<description>
						<![CDATA[
						<p>Is this solution still working? My use it in my Renew stack site?</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>https://theme.co/archive/forums/topic/random-display-of-portfolio/#post-377395</guid>
					<title><![CDATA[Reply To: Random display of Portfolio]]></title>
					<link>https://theme.co/archive/forums/topic/random-display-of-portfolio/#post-377395</link>
					<pubDate>Thu, 03 Sep 2015 04:19:18 +0000</pubDate>
					<dc:creator>Rupok</dc:creator>

					<description>
						<![CDATA[
						<p>Hi <a href="https://theme.co/archive/users/theleoad/" class="bbp-user-mention bbp-user-id-47115"> @theleoad</a></p>
<p>You can try the solution. As your stack is different, you have to create different the file in a different directory &#8211; <strong>wp-content\themes\x-child-renew\framework\views\global</strong> (Re check the stack and name)</p>
<p>Let us know how it goes.</p>
<p>Thanks</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>https://theme.co/archive/forums/topic/random-display-of-portfolio/#post-377400</guid>
					<title><![CDATA[Reply To: Random display of Portfolio]]></title>
					<link>https://theme.co/archive/forums/topic/random-display-of-portfolio/#post-377400</link>
					<pubDate>Thu, 03 Sep 2015 04:21:57 +0000</pubDate>
					<dc:creator>Nico</dc:creator>

					<description>
						<![CDATA[
						<p>Hi There,</p>
<p>Thanks for writing in.</p>
<p>Upon checking the code above, it is still working. You can let us know if it is not working so we could take a closer look on your setup. Don&#8217;t forget to create a new thread so you could send us private details that only you and us could view.</p>
<p>Thanks.</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>https://theme.co/archive/forums/topic/random-display-of-portfolio/#post-377965</guid>
					<title><![CDATA[Reply To: Random display of Portfolio]]></title>
					<link>https://theme.co/archive/forums/topic/random-display-of-portfolio/#post-377965</link>
					<pubDate>Thu, 03 Sep 2015 15:16:42 +0000</pubDate>
					<dc:creator>theleoad</dc:creator>

					<description>
						<![CDATA[
						<p>Hi! It worked beautifully&#8230; </p>
<p>I just need to tell you one thing: the child theme folder structure here for me is different. I installed the child theme this week, and there&#8217;s no such path as you mentioned above. These files I uploaded to wp-content\themes\x-child\framework\views\global.</p>
<p>Thanks a lot for the great support!!</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>https://theme.co/archive/forums/topic/random-display-of-portfolio/#post-378305</guid>
					<title><![CDATA[Reply To: Random display of Portfolio]]></title>
					<link>https://theme.co/archive/forums/topic/random-display-of-portfolio/#post-378305</link>
					<pubDate>Thu, 03 Sep 2015 22:53:47 +0000</pubDate>
					<dc:creator>Friech</dc:creator>

					<description>
						<![CDATA[
						<p>Hi There,</p>
<p>Yes, the <strong>x-child-renew</strong> or <strong>x-child-stackName</strong> is the old naming of the child theme, where different child theme for different stack. But the current version of child theme (<strong>x-child</strong>) is a kind of one for all stack.</p>
<p>Glad we could help, Cheers!</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>https://theme.co/archive/forums/topic/random-display-of-portfolio/#post-709430</guid>
					<title><![CDATA[Reply To: Random display of Portfolio]]></title>
					<link>https://theme.co/archive/forums/topic/random-display-of-portfolio/#post-709430</link>
					<pubDate>Wed, 16 Dec 2015 17:37:56 +0000</pubDate>
					<dc:creator>kelleynunn</dc:creator>

					<description>
						<![CDATA[
						This reply has been marked as private.						]]>
					</description>

					
					
				</item>

					
		
	</channel>
	</rss>

