Jump to content

Sorting based on Repeater Field Values?


Arcturus
 Share

Recommended Posts

I want to revive this thread as I could not find the solution I'm looking for. I've a function using the "repeater" field. I'm using it to display portfolio items (images and text). What I want to achieve is render the items according to category, such as, Web, Print, In Progress etc. I've created a field within "repeater" to specify the category. I've no idea how to make it work.

This is the function I'm using:

function bsRenderPortfolio($portfolio) {
    $out  = "<div class='row portfolio'>";
    foreach ($portfolio as $item) {
        $imgname="";
        foreach($item->images as $img){
          $imgname="<img class='portfolio-image img-responsive' src='".$img->url."' />";
        }
        $out .= "<div class='portfolio-item'>
		<div class='col-xs-12 col-sm-6'>
		<figure class='wow fadeInLeft animated' data-wow-duration='500ms' data-wow-delay='300ms'>
         <div class='img-wrapper'>
		{$imgname}
		<div class='overlay'>
        <div class='summary'>
        <p>{$item->summary}</p>
		</div>
		<div class='buttons'>
		<p><a class='btn btn-lg' href='{$item->button_link}' role='button' data-toggle='tooltip' data-placement='right' title='{$item->button_tooltip}'> {$item->button_title}</a></p>
         </div>
         </div>
		<figcaption>
        <h3>
        $item->title}
        </h3>
        <h5>
        {$item->subheading}
        </h5>
        </figcaption>
		</div>
        </figure>
		</div>
		</div>";
    }
    $out .= "</div>";

    return $out;
}

 

And this is how it is being rendered:

if($page->portfolio)
$content .= bsRenderPortfolio($page->portfolio);

 

Any help would be greatly appreciated. Thanks.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...