Tagged: featured image
- This topic has 7 replies, 3 voices, and was last updated 8 years, 7 months ago by Pratik.
-
AuthorPosts
-
December 8, 2015 at 11:02 am #80801Mandala528Participant
Hi Sakin,
I’ve gone through these forums and was able to find an answer for all of my other questions; thank you for offering such great support!
The one question that I still cannot get an answer for:
The featured image for all Pages and Posts has a permalink to the page you are already on, making it redundant and useless. Is there a way to remove the link once you’re on the page?
An example on my site is:
http://dev.stoneagect.com/services/Thank you for your help.
Peace and love,
Mandala528December 8, 2015 at 12:30 pm #80803PratikParticipantHi @Mandala528,
To remove the link, you need to do a bit of customization using child theme. Please follow following steps:
1. Create A Child Theme for Adventurous Pro. Details for child theme is here
2. In your child theme’s functions.php add following code:/** * Template for overriding parent function for Featured Image in Content */ function adventurous_content_image() { global $post, $wp_query; // Get Page ID outside Loop $page_id = $wp_query->get_queried_object_id(); if( $post) { if ( is_attachment() ) { $parent = $post->post_parent; $individual_featured_image = get_post_meta( $parent,'adventurous-featured-image', true ); } else { $individual_featured_image = get_post_meta( $page_id,'adventurous-featured-image', true ); } } if( empty( $individual_featured_image ) || ( !is_page() && !is_single() ) ) { $individual_featured_image='default'; } // Getting data from Theme Options global $adventurous_options_settings; $options = $adventurous_options_settings; $featured_image = $options['featured_image']; if ( ( $individual_featured_image == 'disable' || '' == get_the_post_thumbnail() || ( $individual_featured_image=='default' && $featured_image == 'disable') ) ) { return false; } else { ?> <figure class="featured-image"> <?php if ( ( is_front_page() && $featured_image == 'featured' ) || $individual_featured_image == 'featured' || ( $individual_featured_image=='default' && $featured_image == 'featured' ) ) { the_post_thumbnail( 'featured' ); } elseif ( ( is_front_page() && $featured_image == 'slider' ) || $individual_featured_image == 'slider' || ( $individual_featured_image=='default' && $featured_image == 'slider' ) ) { the_post_thumbnail( 'slider' ); } else { the_post_thumbnail( 'full' ); } ?> </figure> <?php } }
Thats it. Let me know if this solves your issue or not.
December 9, 2015 at 1:14 am #80818Mandala528ParticipantHi Pratik,
Yes, this solved my issue flawlessly. Thank you very much! Also, thanks for the quick reply; very appreciated!
December 9, 2015 at 8:53 am #80836PratikParticipantHi @Mandala528,
Great. You are welcome. Have a nice day.
April 4, 2016 at 5:23 pm #88794kate-uptonParticipanti would also like to know how to remove links from the slider. any tips on what exactly i would be customizing with the simplecatch_sliders() function? here it is below (i found the following code in the simplecatch_functions.php file)
/** * This function to display featured posts on homepage header * * @get the data value from theme options * @displays on the homepage header * * @useage Featured Image, Title and Content of Post * * @uses set_transient and delete_transient */ function simplecatch_sliders() { global $post; //delete_transient( 'simplecatch_sliders' ); global $simplecatch_options_settings; $options = $simplecatch_options_settings; $postperpage = $options[ 'slider_qty' ]; if( ( !$simplecatch_sliders = get_transient( 'simplecatch_sliders' ) ) && !empty( $options[ 'featured_slider' ] ) ) { echo '<!-- refreshing cache -->'; $simplecatch_sliders = ' <div class="featured-slider">'; $get_featured_posts = new WP_Query( array( 'posts_per_page' => $postperpage, 'post__in' => $options[ 'featured_slider' ], 'orderby' => 'post__in', 'ignore_sticky_posts' => 1 // ignore sticky posts )); $i=0; while ( $get_featured_posts->have_posts()) : $get_featured_posts->the_post(); $i++; $title_attribute = apply_filters( 'the_title', get_the_title( $post->ID ) ); $excerpt = get_the_excerpt(); if ( $i == 1 ) { $classes = "slides displayblock"; } else { $classes = "slides displaynone"; } $simplecatch_sliders .= ' <div class="'.$classes.'"> <div class="featured"> <div class="slide-image">'; if( has_post_thumbnail() ) { $simplecatch_sliders .= '<a href="' . get_permalink() . '" title="Permalink to '.the_title('','',false).'">'; if( $options[ 'remove_noise_effect' ] == "0" ) { $simplecatch_sliders .= '<span class="img-effect pngfix"></span>'; } $simplecatch_sliders .= get_the_post_thumbnail( $post->ID, 'slider', array( 'title' => esc_attr( $title_attribute ), 'alt' => esc_attr( $title_attribute ), 'class' => 'pngfix' ) ).'</a>'; } else { $simplecatch_sliders .= '<span class="img-effect pngfix"></span>'; } $simplecatch_sliders .= ' </div> <!-- .slide-image --> </div> <!-- .featured --> <div class="featured-text">'; if( $excerpt !='') { $simplecatch_sliders .= the_title( '<span>','</span>', false ).': '.$excerpt; } $simplecatch_sliders .= ' </div><!-- .featured-text --> </div> <!-- .slides -->'; endwhile; wp_reset_query(); $simplecatch_sliders .= ' </div> <!-- .featured-slider --> <div id="controllers"> </div><!-- #controllers -->'; set_transient( 'simplecatch_sliders', $simplecatch_sliders, 86940 ); } echo $simplecatch_sliders; } // simplecatch_sliders
April 6, 2016 at 9:37 am #88905PratikParticipantHi @kate-upton,
To remove the permalinks from featured post slider, please follow following steps::
1. Create A Child Theme for Simple Catch Theme. Details for child theme is here
2. In your child theme’s functions.php add the function given here: http://pastebin.com/PPVuyLz0
* It is the same function that you have given, just removed the links. Check line 35 in new code for difference.Let me know how it goes.
Quick Note: For Future references, the reply will be much quicker if you post your issue in a separate post under your theme. This post is for users that use Adventurous Pro theme
April 7, 2016 at 1:12 pm #88965kate-uptonParticipantApril 7, 2016 at 7:11 pm #88981 -
AuthorPosts
- The topic ‘Remove Permalink from Featured Images’ is closed to new replies.