Remove link to Post/Page for featured image

Hi Aigars,

Very well done with this theme. I have just one question: Is it possible to remove the link from the slider, because I just want to use the slider to show some nice pictures without linking posts. :slight_smile: I think I have to comment out something in the “header-extension.php”,… Could you give me some support? Thanks!

Just look for line 336 on header-extensions.php and from there replace it with this code from here.

if ( ! function_exists( 'travelify_featured_post_slider' ) ) :
 * display featured post slider
 * @uses set_transient and delete_transient
function travelify_featured_post_slider() {	
	global $post;
	global $travelify_theme_options_settings;
   $options = $travelify_theme_options_settings;
	$travelify_featured_post_slider = '';
	if( ( !$travelify_featured_post_slider = get_transient( 'travelify_featured_post_slider' ) ) && !empty( $options[ 'featured_post_slider' ] ) ) {	
		$travelify_featured_post_slider .= '
		<section class="featured-slider"><div class="slider-cycle">';
			$get_featured_posts = new WP_Query( array(
				'posts_per_page' 			=> $options[ 'slider_quantity' ],
				'post_type'					=> array( 'post', 'page' ),
				'post__in'		 			=> $options[ 'featured_post_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 ( 1 == $i ) { $classes = "slides displayblock"; } else { $classes = "slides displaynone"; }
				$travelify_featured_post_slider .= '
				<div class="'.$classes.'">';
						if( has_post_thumbnail() ) {
							$travelify_featured_post_slider .= get_the_post_thumbnail( $post->ID, 'slider', array( 'title' => esc_attr( $title_attribute ), 'alt' => esc_attr( $title_attribute ), 'class'	=> 'pngfix' ) ).'</figure>';
						if( $title_attribute != '' || $excerpt !='' ) {
						$travelify_featured_post_slider .= '
							<article class="featured-text">';
							if( $title_attribute !='' ) {
									$travelify_featured_post_slider .= '<div class="featured-title">'. get_the_title() . '</div><!-- .featured-title -->';
							if( $excerpt !='' ) {								
								$travelify_featured_post_slider .= '<div class="featured-content">'.$excerpt.'</div><!-- .featured-content -->';
						$travelify_featured_post_slider .= '
							</article><!-- .featured-text -->';
				$travelify_featured_post_slider .= '
				</div><!-- .slides -->';
			endwhile; wp_reset_query();
		$travelify_featured_post_slider .= '</div>				
		<nav id="controllers" class="clearfix">
		</nav><!-- #controllers --></section><!-- .featured-slider -->';
	set_transient( 'travelify_featured_post_slider', $travelify_featured_post_slider, 86940 );
	echo $travelify_featured_post_slider;	

I guess you will see how much you have to replace. If you are having problems, please let me know and I will try to give you a better explanation.

thanks for you answer! I replaced line 336 to 394 with your code, but with no success… It is still the same situation,

Just open any WordPress post and hit “Update” it should do the trick.

Works, thank you!

is it possible to remove Title and Descriptions too from slider?

Add this to Theme Options - Other - Custom CSS

.featured-text {
    display: none;

Ha! I’m so pleased I managed to find this post. Thank you, I’ll try it out tomorrow :slight_smile:

Thank you for the assistance on this - it worked first time :slight_smile:

However, there is a slight issue: When the mouse pointer is on the slider image, an “alt” box now puts in an appearance. It’s displaying the title (in my case) but I don’t want to see the alt box. I have tried fiddling around but to no avail. Please assist.

I would also like to know whether a theme update (or any other update) would necessitate me patching the .php file again. Ta ever so much …

Oops, I’m back with another problem on The slider images are being cut off at the top. I have uploaded images with dimensions 1018 x 540 (that’s what they are in the media library) but when they are displayed, the height has been changed to 460: . Again I’ve messed around but to no avail. I really would appreciate a solution to this issue.

Images are resized automatically to fit slider. You can change default values via functions.php file. Right now featured image size is defined like this

add_image_size( 'slider', 1018, 460, true );

You can adjust that but you will have to regenerate thumbnails because WordPress doesn’t do it automatically. There are several plugins for that, such as

Thanks Aigars, I really do appreciate your assistance - support at the level you provide is rare indeed!
A few points though:

  1. Obviously I want to maintain the site as is. So what kind of update(s) will necessitate me having to make the changes to the .php files again?
  2. Is there any chance of getting rid of the “alt” box? If not, I suppose I could un-title the relevant posts …
  3. Regarding the slider image size, the on-screen Theme documentation (Theme Options) states that the size is “recommended”. Clearly, as matters stand, the recommended size is actually mandatory. I’m definitely not going to be the only one facing this issue so perhaps it needs to be addressed at the Theme level. Bear in mind that a thin wide image is expected for a header slider but something in the body really should be more flexible. Many people will want to show off their images in this slider and 1018 x 460 isn’t a good size for doing that - the height needs to be user defined…
  1. Any changes made directly inside theme files (css, php, js, etc) will be overwritten with the theme update. WordPress doesn’t bother checking what’s new in the theme and it overwrites the entire directory.

  2. The best options is to make all these changes via Child Theme. I can help you to setup slider properly via Child Theme but it is out of scope of free support as it takes a lot of time to implement.

  3. It is not “mandatory”, because any image size will work just fine. The best results will be when you use recommended image size since it won’t be resized at all.
    Resizing is done because it is requires as “best practices”. If developers would allow to upload any image size without resizing, some would come up with 30MB image directly from Canon EOS 5D Mark III or similar camera. Imagine website when 10 images would be used as featured images and 5 for slider. This is why we must limit image size.

Featured image size can be simply changed by adding this value to Child Theme functions.php file and it will overwrite original values.

add_image_size( 'slider', 1018, 460, true );


Does the mod for removing links from the slider (detailed above) work for the current version 1.5.0? If not, can you show the code needed?

A future feature: a config option to turn on/off on the slider links. Right now I don’t need them however, can imagine situations where it can be really useful have the links.

What are the changes from the last version?

Many thanks, PJ

This code will still work as of Travelify 1.5.0.

If you feel that you need a more control over where these slides are pointing, you can use plugin such as this one:

You can use any link there that point inside or even outside your website.

Changes can be found on Theme readme.txt file:

This is a must have update because it fixes several bugs such as Navigation bug, Page and Blog title placement. Other changes are translation related but many users will highly appreciate them.

Thanks for the reply and plug-in suggestion.

If I understand the Codex correctly, the mod can go in header-extensions.php in a child theme.

Great support as always.

Rgds, PJ

WordPress doesn’t recognize custom files via Child Theme and will work only with page.php, single.php, archive.php and other default files. However, you can modify and copy/paste functions from header-extension.php into Child Theme functions.php and it will work like it should.It will basically replace original functions.

I had successfully used the code above to remove links from the featured slider in the last version of Travelify. I just updated the theme and re-inserted the code above into header-extensions.php but there are still links in the featured slider (which I would like to remove).

Do you have any suggestions how to address this?

Thank you.

Nevermimd - forgot to hit ‘update’ in a post. It is working now. Thank you for all the support in this forum!

Hi Aigars,

Thanks for this impressive wp-theme Travelify! I managed to find the file you said header-extensions.php and I replaced the code with yours. Did update in each post and now there are no links, it works like a champ ahah! Many thanks!

The full path for the file is themes > travelify > library > structure Maybe this can help someone :slight_smile:

Have a good day!