-
AuthorPosts
-
April 26, 2014 at 7:24 pm #256671
Hello
My ticket was closed because what I asked need custom developpement: https://kriesi.at/support/topic/featured-image-with-or-withouk-a-lightbox-effect/As I could not wait for it, I dot my selfnad yes it works. ;-)
Look at this page: http://www.strategies-ecommerce.com/actualites/paroles-d-experts/connecter-reseau-vente
The big featured image has no link, no lightbox effect
And this one has a lighbox effect: http://www.strategies-ecommerce.com/actualites/paroles-d-experts/transformation-cross-canal-entreprise> First image is purely decorative and has nothin important to show, the second image contains importants stuffs…
So how i did it?
You nedd 2 files: function.php and a child copy of loop-index.php.FUNCTION.PHP
Add this code:function add_myfeaturedimage_boxes() { add_meta_box('nofeaturedimage',__('LightBox effect on Featured Image?','avia_framework'), 'nofeaturedimagetitre_meta_box','post', 'side', 'high'); } add_action( 'admin_init', 'add_myfeaturedimage_boxes', 0 ); function nofeaturedimagetitre_meta_box(){ global $post; echo '<div class="">'; if( get_post_meta($post->ID, 'myfeaturedimage' , true)!='' && get_post_meta($post->ID, 'myfeaturedimage' , true) == 'true') { echo '<input type="radio" name="myfeaturedimage" class="myfeaturedimage" id="myfeaturedimage-0" value="true" checked="checked" /><label for="myfeaturedimage-" class="post-format-standard">'.__('Yes','avia_framework').'</label>'; echo '<br />'; echo '<input type="radio" name="myfeaturedimage" class="myfeaturedimage" id="myfeaturedimage-1" value="false" /><label for="myfeaturedimage-1" class="post-format-standard">'.__('No','avia_framework').'</label>'; } else { echo '<input type="radio" name="myfeaturedimage" class="myfeaturedimage" id="myfeaturedimage-0" value="true" /><label for="myfeaturedimage-" class="post-format-standard">'.__('Yes','avia_framework').'</label>'; echo '<br />'; echo '<input type="radio" name="myfeaturedimage" class="myfeaturedimage" id="myfeaturedimage-1" value="false" checked="checked" /><label for="myfeaturedimage-1" class="post-format-standard">'.__('No','avia_framework').'</label>'; } echo '</div>'; } function myfeaturedimage_save_postdata( $post_id ) { if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) return; if ( !current_user_can( 'edit_page', $post_id ) ) return; if ( !current_user_can( 'edit_post', $post_id ) ) return; if( isset($_POST['myfeaturedimage'])) {update_post_meta($post_id, 'myfeaturedimage', $_POST['myfeaturedimage']);} } add_action( 'save_post', 'myfeaturedimage_save_postdata' );
LOOP-INDEX.PHP
Look for this line:if($slider) $slider = '<a href="'.$link.'" title="'.$featured_img_desc.'">'.$slider.'</a>';
Remove it or comment it and replace it by:if( get_post_meta($post->ID, 'myfeaturedimage' , true)!='' && get_post_meta($post->ID, 'myfeaturedimage' , true) == 'false') { if($slider) $slider = $slider; } else { if($slider) $slider = '<a href="'.$link.'" title="'.$featured_img_desc.'">'.$slider.'</a>'; }
Thats’alll
April 27, 2014 at 11:59 am #256773Hey pako69!
Great, glad you solved it :)
Cheers!
PeterApril 30, 2014 at 10:59 am #258183ENFOLD V2.7: added: option that allows disabling post feature image on single post
;-)
-
AuthorPosts
- The topic ‘reopen my ticket: "Featured image : with or withouk a lightbox effect"’ is closed to new replies.