Tagged: featured image, masonry, Portfolio
-
AuthorPosts
-
June 24, 2015 at 4:26 pm #464180
Hi, is it possible to highlight (add a featured banner or ribbon) to 1 specific portfolio item image in a masonry portfolio. This site is for a real estate agent selling pre-construction condo units in several different condo projects. I’ve got it set up so each project is a separate portfolio item and is displayed in the masonry portfolio. He wants to be able to choose one of the projects to be a featured project. Here is a link to the site so you know what I mean: http://findnewcondos.com
Thank you.
June 25, 2015 at 9:34 am #464469Hi Jameel!
Thank you for using Enfold.
I would like to check the page but the website is currently on maintenance mode. Please post a temporary login details here so that we can check the masonry item. If possible, please provide a screenshot of what you’re trying to do. Use imgur or dropbox for the screenshot.
Regards,
IsmaelJune 25, 2015 at 3:48 pm #464591Hi Ismael, The site is not supposed to be in maintenance mode. I don’t get the maintenance mode on my end, even when i’m not logged in.
I’ve attached the login info in the private section.
Here is the screenshot of what i’m trying to do: http://i.imgur.com/4SNAZq8.jpg
As you can see on the top left image of the masonry portfolio, I would like to add a banner on the corner of the image that says “Featured Project”. It’s similar to what you guys have here on your forum reply boxes where it says “Team Kriesi.at”.
Thank you!
June 26, 2015 at 11:27 am #464870Hi!
Add this in the functions.php file:
add_filter( 'avf_masonry_loop_prepare', 'avf_masonry_loop_prepare_mod', 10, 2 ); function avf_masonry_loop_prepare_mod( $key, $entries ) { $postcategories = get_the_terms($key['ID'], 'portfolio_entries'); $categorylist = array(); if ($postcategories) { foreach($postcategories as $cat) { $categorylist[] = $cat->name; } } $featured = in_array("Featured",$categorylist); foreach ( $key as $post => $value ) { if ( $post == 'content' && $featured) { $value .= "<div class='av-masonry-featured'>Featured Project</div>"; } $key[$post] = $value; } return $key; }
Edit the portfolio item that you want to set as featured project then add a new category called “Featured”. You will know that it works if you see the “Featured Project” text in the portfolio item. Use the .av-masonry-featured selector to change the style of the text.
Best regards,
IsmaelJune 26, 2015 at 4:19 pm #465041Hi Ismael, that didn’t work for me.
– I added the code to the functions.php file.
– I created a new portfolio category called “Featured” and chose it for the portfolio item.
– I made sure Featured was selected in the Masonry Element.Nothing changed except Featured is now an option in the sort list at the top.
June 30, 2015 at 10:57 am #466289Hi!
I actually updated the code above. Let’s start again. Please use this instead:
add_filter( 'avf_masonry_loop_prepare', 'avf_masonry_loop_prepare_mods', 10, 2 ); function avf_masonry_loop_prepare_mods( $key, $entries ) { $postcategories = get_the_terms($key['ID'], 'portfolio_entries'); $categorylist = array(); if ($postcategories) { foreach($postcategories as $cat) { $categorylist[] = $cat->name; } } $featured = in_array("Featured",$categorylist); foreach ( $key as $post => $value ) { if ( $post == 'text_before' && $featured) { $value .= "<div class='masonry-featured'></div>"; } $key[$post] = $value; } return $key; }
After that, add this below:
add_action('wp_footer', 'ava_custom_script', 10); function ava_custom_script(){ ?> <script> (function($) { $('#top .av-masonry-entry').each(function() { if($(this).find('.masonry-featured').length) { $(this).find('.av-inner-masonry').prepend('<div class="av-masonry-featured">Featured Project</div>'); } }); }(jQuery)); </script> <?php }
Cheers!
IsmaelJune 30, 2015 at 3:12 pm #466495Hi, unfortunately that didn’t do what I needed it to do.
With the code you sent, it added the text Featured Project below the title when you hover over the image. I need it to look like the image I sent you previously (http://i.imgur.com/4SNAZq8.jpg) with the Featured Project on the top right corner of the image in in white with an orange background to match the site.
Thank you for all your help so far, it’s much appreciated.
July 1, 2015 at 11:53 am #466903Hey!
You didn’t update the first code. Please check it now. You should see the “Featured” text on the top left corner of the portfolio item. Use the “.av-masonry-featured” selector to change the style of the “Featured Project” text.
Regards,
IsmaelJuly 1, 2015 at 4:30 pm #467093Thank you!
It seems that the text is on the overlay layer. How would I get the opacity up on the “.av-masonry-featured” selector not not on the overlay layer?
July 2, 2015 at 9:15 am #467351 -
AuthorPosts
- You must be logged in to reply to this topic.