Hi kriesi!
Glad to see that your forum is back!
On your old forum you had a topic talking about how to add "Sort by Price" and "Get it for..." in the "Portfolio" section (same as your actual site).
Can you please tell us again how to had this functionality to the template.
Thx again for your help.
You
Sort by Price / Get it for...
9 posts from 2 voices-
Posted 2 years ago #
-
Assuming you want the same functionality as this, there are a few steps you need to complete.
1.) Open up template_portfolio.php and find this code:
<a href="#" id='name_sort'><?php _e('Name','cleancut')?></a>Immediately under this (and before the closing </div>) add this code:
<a href="#" id='price_sort' class='reversed'><?php _e('Price','cleancut')?></a>2.) Next step is to add the code to display the value for each entry. This won't be visible on the page but will be in the source code.
In template_portfolio.php, find this code:
echo "<a href=".get_permalink()." class='more-link'>".__('Read more','cleancut')."</a>";Replace it with this:
// add sort by price $the_price = get_post_meta($post->ID, "_price", true); $the_product_page = get_post_meta($post->ID, "_product_url", true); $the_product_buy_now = get_post_meta($post->ID, "_product_buy_now", true); if ($the_price <> "") { // if price is set it is item for sale so display price and demo link echo "<span class='price_sort hidden'>"; echo $the_price; echo "</span>"; echo "<a href='".$the_product_page."' class='more-link'>".__('Live Demo','cleancut')."</a>"; echo "<a href='".$the_product_buy_now."' class='more-link buy-now'>".__('Buy now for £','cleancut').$the_price."</a>"; } else { echo "<a href='".get_permalink()."' class='more-link'>".__('Read more','cleancut')."</a>"; }This add a conditional variable which will only display the price button if the portfolio item has a price attached to it. If it doesn't, it will display the regular "Read More" text.
3.) You now need to add 3 custom fields to set the Price, Product Demo URL and Buy Now links. Open up /theme_options/portfolio.php and find this code:
'supports' => array('title','thumbnail','excerpt','editor','comments')Change it to this:
'supports' => array('title','thumbnail','excerpt','editor','comments', 'custom-fields')This adds custom fields support to the Portfolio post type so you can add your Price, Product Demo URL and Buy Now links.
4.) When you create / edit a portfolio entry, you need to add the custom fields for Price, Product Demo URL and Buy Now links.
Open up /theme_options/meta_box.php and find this code:
$options[] = array( "name" => "<strong>Additional Headline</strong><br/>Enter a headline that should appear above your entry/page here.", "desc" => "", "id" => "_headline", "std" => "", "size" => 70, "type" => "text");Change it to this:
$options[] = array( "name" => "<strong>Additional Headline</strong><br/>Enter a headline that should appear above your entry/page here.", "desc" => "", "id" => "_headline", "std" => "", "size" => 70, "type" => "text"); $options[] = array( "name" => "<strong>Product Information</strong><br/>Enter the URL for more information page. <strong>Note:</strong> Must be specified or link will break.", "desc" => "", "id" => "_product_url", "std" => "", "size" => 70, "type" => "text"); $options[] = array( "name" => "<strong>Buy It Now</strong><br/>Enter the URL for Buy It Now page (e.g. through e-junkie.com). <strong>Note:</strong> If product is for sale, this must be specified or link will break.", "desc" => "", "id" => "_product_buy_now", "std" => "", "size" => 70, "type" => "text"); $options[] = array( "name" => "<strong>Product Price</strong><br/>Enter the price if this portfolio item is for sale. Leave blank to disable Buy It Now button.", "desc" => "", "id" => "_price", "std" => "", "size" => 20, "type" => "text");5.) When you create / edit a portfolio entry, you will see some extra fields in you Meta Box section, looking like this:

Let me know if this needs further clarification, I appreciate it can be hard to follow with so many complex steps.
Posted 2 years ago # -
Hi James!
Thx for your help it works like a charm and with the "custom field" function it makes it easier to use!
One last thing before telling to everyone that it's "resolved" can you tell me what to change on my CSS to have the "get it for £" button next to "Read more" and not below?
Thx again for your help
Posted 2 years ago # -
Glad it worked well, you need to copy and paste this to the end of you style.css file:
.portfolio_entry div .more-link { float:left; } .portfolio_entry div .buy-now{ float:right; } .portfolio_entry div .buy-now:after{ clear: both; }Posted 2 years ago # -
Awsome!
thx for this quick supportPosted 2 years ago # -
Hi James
Sorry to bother you again with this problem but I realise that I have a compatibility problem with IE (Chrome & Firefox work fine).
The Portfolio doesn't work since I add the shop functionality... any idea?Here is the link of the portfolio: http://younesdesign.com/portfolio/
Thx again for your support!
Posted 2 years ago # -
Hmm... You're missing the closing a on price sort - should look like this:
<a href="#" id='price_sort' class='reversed'><?php _e('Price','cleancut')?></a>Does this fix the problem?
What version of IE are you using?
Posted 2 years ago # -
Damn!!! it was exactly the problem... I missed the closing a...
Raaaaaaaa I hate asking for help when it's something easy as that... sorry
Thx again...Posted 2 years ago # -
Hey!
Cool, marking this as resolved and closing topic.
If you have any other questions please open a new topic.
Best regards,
JamesPosted 2 years ago #
Topic Closed
This topic has been closed to new replies.














