WordPress.org

Ready to get started?Download WordPress

Forums

Simple Catch
[resolved] How to remove permalink from featured slider (19 posts)

  1. icing
    Member
    Posted 1 year ago #

    I need to remove the url linking from featured slider included with this theme. What do I need to do to get that?

    I have already created a child theme.

    http://wordpress.org/extend/themes/simple-catch/

  2. icing
    Member
    Posted 1 year ago #

    Till i find the solution to this, I will use Easing Slider Plugin.

  3. Catch Themes
    Member
    Theme Author

    Posted 1 year ago #

    You need to customize the simplecatch_sliders() function or you can upgrade to Simple Catch Pro and use Featured Image Slider where you can add images without links as well. No need to be posts...

  4. silico26
    Member
    Posted 1 year ago #

    i 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
  5. icing
    Member
    Posted 1 year ago #

    something to do with this?
    $simplecatch_sliders .= '<a href="' . get_permalink() . '" title="Permalink to '.the_title('','',false).'">';

  6. luichy
    Member
    Posted 1 year ago #

    Didn't see a solution in the thread. Could you explain?

  7. silico26
    Member
    Posted 1 year ago #

    i don't believe a solution has been found for this yet

  8. Catch Themes
    Member
    Theme Author

    Posted 1 year ago #

    @silico26 : you can just replace ' . get_permalink() . ' with # . see it below:

    $simplecatch_sliders .= '<a href="#" title="Permalink to '.the_title('','',false).'">';

    After you make the change, you need to clear the cache set by set_transient( 'simplecatch_sliders', $simplecatch_sliders, 86940 );

    So, to clear the cache you can change any value in Slider option from your WordPress Dashboard.

  9. silico26
    Member
    Posted 1 year ago #

    thanks for your reply sakin. i removed the link, but am unable to change it to a custom link. did i follow your directions correctly? i am mostly confused about the cache part you mentioned. here is what i did:

    i took the simplecatch_functions.php file (located here:
    wp-content/themes/simple-catch/functions/simplecatch_functions.php)

    and pasted it into a child theme directory (wp-content/themes/simple-catch-child)

    and i removed this part of it:

    ( get_permalink() ) . '">' . sprintf( __( '%s', 'simplecatch' ), esc_attr( $more_tag_text ) ) . '</a>';

    and replaced it it with this:

    ( $simplecatch_sliders .= '<a href="http://www.google.com" title="Permalink to '.the_title('','',false).'">'; ) . '">' . sprintf( __( '%s', 'simplecatch' ), esc_attr( $more_tag_text ) ) . '</a>';

    when i reuploaded the file to the child theme directory, it effectively removed the link, but did not add the example google link. maybe this is because i did not follow or understand this part you mentioned below?


    After you make the change, you need to clear the cache set by set_transient( 'simplecatch_sliders', $simplecatch_sliders, 86940 );

    So, to clear the cache you can change any value in Slider option from your WordPress Dashboard.

  10. luichy
    Member
    Posted 1 year ago #

    Thanks, Sakin.

    Now if I could just remove the post excerpt below the featured images it would be great.

  11. silico26
    Member
    Posted 1 year ago #

    @luichy were you able to add a custom link via sakin's instructions above?

  12. luichy
    Member
    Posted 1 year ago #

    Sorry, silico26. I just needed to remove the permalink and it worked. Although partially, because there's still a link to the homepage.

  13. Catch Themes
    Member
    Theme Author

    Posted 1 year ago #

    @silico26: I mean you need to clear the cache by delete_transient which you don't need to code it but can change any setting fields in Slider option from your WordPress Dashboard otherwise you have to wait for 24 hours to clear the cache.

  14. silico26
    Member
    Posted 1 year ago #

    interesting luichy, mine removed the link altogether, no link to the home page.

  15. Catch Themes
    Member
    Theme Author

    Posted 1 year ago #

    @luichy: # means it will link to # of homepage but the slider is in homepage so it just like removing the link. If you want to totally remove the link then you have to delete whole line

    $simplecatch_sliders .= '<a href="' . get_permalink() . '" title="Permalink to '.the_title('','',false).'">';

    and in the following line just delete .''

    $simplecatch_sliders .= get_the_post_thumbnail( $post->ID, 'slider', array( 'title' => esc_attr( $title_attribute ), 'alt' => esc_attr( $title_attribute ), 'class'	=> 'pngfix' ) ).'</a>';
  16. silico26
    Member
    Posted 1 year ago #

    @silico26: I mean you need to clear the cache by delete_transient which you don't need to code it but can change any setting fields in Slider option from your WordPress Dashboard otherwise you have to wait for 24 hours to clear the cache.

    i guess i am too much of a noob to understand what you're saying, but i appreciate you trying. the fact that the link was removed after i uploaded my tweaked php file makes me think that it's not a matter of the cache needing to be cleared but an error in the code somewhere

  17. luichy
    Member
    Posted 1 year ago #

    Sakin, sorry for the newb question, but how do I override the simplecatch_functions.php of the parent theme? Do I just make a simplecatch_functions.php in the child and it automatically overrides the parent?

    Sorry for being such a newb.

  18. silico26
    Member
    Posted 1 year ago #

    @ luichy, that seemed to work for me!

  19. iamkokes
    Member
    Posted 1 year ago #

    @Sakin, thank you so much!

    I also wanted to mention that I was a little confused about that second line you said to edit. I specifically had to remove " '</a>' " to make it work.

Topic Closed

This topic has been closed to new replies.

About this Theme

About this Topic