Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • #95852
    Trav
    Participant

    I’m using Catch Kathmandu Pro, and trying to remove the links which are associated with the Slider. It’s a homepage slider, type ‘Category Slider’.

    Is the answer similar to this one, for a different theme?
    https://catchthemes.com/support-forum/topic/remove-permalink-from-featured-images/

    Are there any options to alter the slider, and remove the text, only have the image?

    Thanks heaps

    #95862
    Mahesh
    Keymaster

    @nextgenf: For that you’ll need to create a child theme. You can find more details on creating child theme HERE. Then in your child theme’s functions.php, add the following code:

    function catchkathmandu_category_sliders() {
    	//delete_transient( 'catchkathmandu_category_sliders' );
    
    	global $post;
    	global $catchkathmandu_options_settings;
       	$options = $catchkathmandu_options_settings;
    
    	if( ( !$catchkathmandu_category_sliders = get_transient( 'catchkathmandu_category_sliders' ) ) && !empty( $options[ 'slider_category' ] ) ) {
    		echo '<!-- refreshing cache -->';
    
    		$catchkathmandu_category_sliders = '
    		<div id="main-slider" class="container">
            	<section class="featured-slider">';
    				$get_featured_posts = new WP_Query( array(
    					'posts_per_page'		=> $options[ 'slider_qty' ],
    					'category__in'			=> $options[ 'slider_category' ],
    					'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 = 'post pageid-'.$post->ID.' hentry slides displayblock'; } else { $classes = 'post pageid-'.$post->ID.' hentry slides displaynone'; }
    					$catchkathmandu_category_sliders .= '
    					<article class="'.$classes.'">
    						<figure class="slider-image">'. get_the_post_thumbnail( $post->ID, 'slider', array( 'title' => esc_attr( $title_attribute ), 'alt' => esc_attr( $title_attribute ), 'class'	=> 'pngfix' ) ).
    						'</figure>
    						<div class="entry-container">
    							<header class="entry-header">
    								<h1 class="entry-title">
    									<a title="Permalink to '.the_title('','',false).'" href="' . get_permalink() . '">'.the_title( '<span>','</span>', false ).'</a>
    								</h1>
    								<div class="assistive-text">'.catchkathmandu_page_post_meta().'</div>
    							</header>';
    							if( $excerpt !='') {
    								$catchkathmandu_category_sliders .= '<div class="entry-content">'. $excerpt.'</div>';
    							}
    							$catchkathmandu_category_sliders .= '
    						</div>
    					</article><!-- .slides -->';
    				endwhile; wp_reset_query();
    				$catchkathmandu_category_sliders .= '
    			</section>
            	<div id="slider-nav">
            		<a class="slide-previous"><</a>
            		<a class="slide-next">></a>
            	</div>
            	<div id="controllers"></div>
      		</div><!-- #main-slider -->';
    
    	set_transient( 'catchkathmandu_category_sliders', $catchkathmandu_category_sliders, 86940 );
    	}
    	echo $catchkathmandu_category_sliders;
    } // catchkathmandu_category_sliders

    Removing text from slider, you can use Custom CSS. Go to Dashboard=> Appearance=> Customzie=> Theme Options=> Custom CSS and add the following CSS:

    #main-slider .entry-container {
        display: none;
    }

    Regards,
    Mahesh

    #96137
    Roland
    Participant

    Hi Mahesh,

    I would also like to remove the links associated with my slider images, however I’m using the post-slider option rather than the category-slider. Can I simply substitute all instances of “category” with “post” in your code or is that too simplistic?

    Thanks

    Roland

    #96155
    Mahesh
    Keymaster

    @rolandallen: Thought you were using Category Slider. 🙂
    For Post Slider, add the following code intead:

    function catchkathmandu_post_sliders() {
    	//delete_transient( 'catchkathmandu_post_sliders' );
    
    	global $post;
    	global $catchkathmandu_options_settings;
       	$options = $catchkathmandu_options_settings;
    
    	if( ( !$catchkathmandu_post_sliders = get_transient( 'catchkathmandu_post_sliders' ) ) && !empty( $options[ 'featured_slider' ] ) ) {
    		echo '<!-- refreshing cache -->';
    
    		$catchkathmandu_post_sliders = '
    		<div id="main-slider" class="container">
            	<section class="featured-slider">';
    				$get_featured_posts = new WP_Query( array(
    					'posts_per_page' => $options[ 'slider_qty' ],
    					'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 = 'post postid-'.$post->ID.' hentry slides displayblock'; } else { $classes = 'post postid-'.$post->ID.' hentry slides displaynone'; }
    					$catchkathmandu_post_sliders .= '
    					<article class="'.$classes.'">
    						<figure class="slider-image">
    							'. get_the_post_thumbnail( $post->ID, 'slider', array( 'title' => esc_attr( $title_attribute ), 'alt' => esc_attr( $title_attribute ), 'class'	=> 'pngfix' ) ).'
    						</figure>
    						<div class="entry-container">
    							<header class="entry-header">
    								<h1 class="entry-title">
    									<a title="Permalink to '.the_title('','',false).'" href="' . get_permalink() . '">'.the_title( '<span>','</span>', false ).'</a>
    								</h1>
    								<div class="assistive-text">'.catchkathmandu_page_post_meta().'</div>
    							</header>';
    							if( $excerpt !='') {
    								$catchkathmandu_post_sliders .= '<div class="entry-content">'. $excerpt.'</div>';
    							}
    							$catchkathmandu_post_sliders .= '
    						</div>
    					</article><!-- .slides -->';
    				endwhile; wp_reset_query();
    				$catchkathmandu_post_sliders .= '
    			</section>
            	<div id="slider-nav">
            		<a class="slide-previous"><</a>
            		<a class="slide-next">></a>
            	</div>
            	<div id="controllers"></div>
      		</div><!-- #main-slider -->';
    
    	set_transient( 'catchkathmandu_post_sliders', $catchkathmandu_post_sliders, 86940 );
    	}
    	echo $catchkathmandu_post_sliders;
    } // catchkathmandu_post_sliders

    Regards,
    Mahesh

    #96177
    Roland
    Participant

    Hi Mahesh,

    Thanks for responding so quickly.

    Unfortunately this doesn’t seem to work, probably because I have wrongly inserted your code. Here’s my functions.php with your code inserted:

    <?php
    /**
    * Child Theme functions and definitions
    *
    */
    add_action( ‘wp_enqueue_scripts’, ‘catchkathmandu_child_enqueue_styles’ );
    function catchkathmandu_child_enqueue_styles() {
    wp_enqueue_style( ‘catchkathmandu-parent-style’, get_template_directory_uri() . ‘/style.css’ );
    }
    function catchkathmandu_post_sliders() {
    //delete_transient( ‘catchkathmandu_post_sliders’ );

    global $post;
    global $catchkathmandu_options_settings;
    $options = $catchkathmandu_options_settings;

    if( ( !$catchkathmandu_post_sliders = get_transient( ‘catchkathmandu_post_sliders’ ) ) && !empty( $options[ ‘featured_slider’ ] ) ) {
    echo ‘<!– refreshing cache –>’;

    $catchkathmandu_post_sliders = ‘
    <div id=”main-slider” class=”container”>
    <section class=”featured-slider”>’;
    $get_featured_posts = new WP_Query( array(
    ‘posts_per_page’ => $options[ ‘slider_qty’ ],
    ‘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 = ‘post postid-‘.$post->ID.’ hentry slides displayblock’; } else { $classes = ‘post postid-‘.$post->ID.’ hentry slides displaynone’; }
    $catchkathmandu_post_sliders .= ‘
    <article class=”‘.$classes.'”>
    <figure class=”slider-image”>
    ‘. get_the_post_thumbnail( $post->ID, ‘slider’, array( ‘title’ => esc_attr( $title_attribute ), ‘alt’ => esc_attr( $title_attribute ), ‘class’ => ‘pngfix’ ) ).’
    </figure>
    <div class=”entry-container”>
    <header class=”entry-header”>
    <h1 class=”entry-title”>
    ‘.the_title( ‘<span>’,'</span>’, false ).’
    </h1>
    <div class=”assistive-text”>’.catchkathmandu_page_post_meta().'</div>
    </header>’;
    if( $excerpt !=”) {
    $catchkathmandu_post_sliders .= ‘<div class=”entry-content”>’. $excerpt.'</div>’;
    }
    $catchkathmandu_post_sliders .= ‘
    </div>
    </article><!– .slides –>’;
    endwhile; wp_reset_query();
    $catchkathmandu_post_sliders .= ‘
    </section>
    <div id=”slider-nav”>
    <
    >
    </div>
    <div id=”controllers”></div>
    </div><!– #main-slider –>’;

    set_transient( ‘catchkathmandu_post_sliders’, $catchkathmandu_post_sliders, 86940 );
    }
    echo $catchkathmandu_post_sliders;
    } // catchkathmandu_post_sliders

    /**
    * Loading Parent theme stylesheet
    *
    */

    Kind regards,

    Roland

    #96192
    Roland
    Participant

    Hi Mahesh,

    I’m afraid I can’t get this to work, perhaps I’ve inserted it incorrectly into the child theme functions.php? Here’s the file:

    <?php
    /**
     * Child Theme functions and definitions
     *
     */
    add_action( 'wp_enqueue_scripts', 'catchkathmandu_child_enqueue_styles' );
    function catchkathmandu_child_enqueue_styles() {
        wp_enqueue_style( 'catchkathmandu-parent-style', get_template_directory_uri() . '/style.css' );
    }
    function catchkathmandu_post_sliders() {
    	//delete_transient( 'catchkathmandu_post_sliders' );
    
    	global $post;
    	global $catchkathmandu_options_settings;
       	$options = $catchkathmandu_options_settings;
    
    	if( ( !$catchkathmandu_post_sliders = get_transient( 'catchkathmandu_post_sliders' ) ) && !empty( $options[ 'featured_slider' ] ) ) {
    		echo '<!-- refreshing cache -->';
    
    		$catchkathmandu_post_sliders = '
    		<div id="main-slider" class="container">
            	<section class="featured-slider">';
    				$get_featured_posts = new WP_Query( array(
    					'posts_per_page' => $options[ 'slider_qty' ],
    					'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 = 'post postid-'.$post->ID.' hentry slides displayblock'; } else { $classes = 'post postid-'.$post->ID.' hentry slides displaynone'; }
    					$catchkathmandu_post_sliders .= '
    					<article class="'.$classes.'">
    						<figure class="slider-image">
    							'. get_the_post_thumbnail( $post->ID, 'slider', array( 'title' => esc_attr( $title_attribute ), 'alt' => esc_attr( $title_attribute ), 'class'	=> 'pngfix' ) ).'
    						</figure>
    						<div class="entry-container">
    							<header class="entry-header">
    								<h1 class="entry-title">
    									<a title="Permalink to '.the_title('','',false).'" href="' . get_permalink() . '">'.the_title( '<span>','</span>', false ).'</a>
    								</h1>
    								<div class="assistive-text">'.catchkathmandu_page_post_meta().'</div>
    							</header>';
    							if( $excerpt !='') {
    								$catchkathmandu_post_sliders .= '<div class="entry-content">'. $excerpt.'</div>';
    							}
    							$catchkathmandu_post_sliders .= '
    						</div>
    					</article><!-- .slides -->';
    				endwhile; wp_reset_query();
    				$catchkathmandu_post_sliders .= '
    			</section>
            	<div id="slider-nav">
            		<a class="slide-previous"><</a>
            		<a class="slide-next">></a>
            	</div>
            	<div id="controllers"></div>
      		</div><!-- #main-slider -->';
    
    	set_transient( 'catchkathmandu_post_sliders', $catchkathmandu_post_sliders, 86940 );
    	}
    	echo $catchkathmandu_post_sliders;
    } // catchkathmandu_post_sliders
    
    /**
     * Loading Parent theme stylesheet
     *
     */
    

    Kind regards,

    Roland

    #96229
    Mahesh
    Keymaster

    @rolandallen:
    Hi Roland,

    What seems to be the problem. I tried your code in our server and it is working fine.
    Let me know further. Please post in your site URL.

    Regards,
    Mahesh

    #96238
    Roland
    Participant

    Hi Mahesh,

    Apologies, I’ve checked again and the image redirection has now been suppressed – many thanks!

    However when I click on the the text label I still get redirected to the image on its own page. I’d like to keep the label but stop it hyperlinking to the image page?

    The web site is currently “under construction” and is only accessible via administrator login.

    Kind regards,

    Roland

    #96248
    Mahesh
    Keymaster

    @rolandallen: For that, you’ll need to do a little change in the above code. In the above code replace the following line:

    <h1 class="entry-title">
        <a title="Permalink to '.the_title('','',false).'" href="' . get_permalink() . '">'.the_title( '<span>','</span>', false ).'</a>
    </h1>

    With the code below:
    <h1 class="entry-title">' . the_title() . '</h1>

    Regards,
    Mahesh

    #96258
    Roland
    Participant

    Hi Mahesh,

    This seems to work, however the down side is that I can no longer see the coloured overlay box with the post title in it. I now see a thin horizontal portion of the original box, without the text?

    Sorry for the protracted nature of this issue – your help is much appreciated.

    Kind regards,

    Roland

    #96312
    Mahesh
    Keymaster

    @rolandallen: Sorry, my mistake, the code should be as follows:
    <h1 class="entry-title">' . get_the_title() . '</h1>
    Let me know if any problem.

    Regards,
    Mahesh

    #96376
    Roland
    Participant

    Hi Mahesh,

    All working fine now – many thanks indeed.

    Kind regards,

    Roland

    #96388
    Mahesh
    Keymaster

    @rolandallen: Thank you for your appreciation. Have a nice day!

    Regards,
    Mahesh

Viewing 13 posts - 1 through 13 (of 13 total)
  • The topic ‘Slider – remove links’ is closed to new replies.