- This topic has 5 replies, 2 voices, and was last updated 8 years, 11 months ago by Mahesh.
-
AuthorPosts
-
January 27, 2016 at 4:42 am #83835RaieleneMember
I need about 10 different slider images to link to only one particular page. What do I need to edit to make that happen?
(At the moment I have them all set to a category I created called “slider”, but of course, they all link to their own post. I want them to link to a static page, and all the same page.)
January 27, 2016 at 11:01 am #83854MaheshParticipantHi @Raielene,
In Catch Kathmandu Free Version, you can only put the post images in the slider, and the link by default points to its relative post. In Catch Kathmandu Pro Version, you have other features in slider image such as post, page, category or custom image (with custom link). I recommend you to upgrade to Pro version.
Regards,
MaheshJanuary 28, 2016 at 1:16 am #83898RaieleneMemberRight, but the way they seem to work is by having one image as the featured image… which is why I’m using about 10 posts to show all the images I want in my slider. But what I want is all 10 slider images to point to just *one* page. The same page. If I could make them point to one post (the same post) that would work too.
January 28, 2016 at 9:46 am #83917MaheshParticipantHi @Raielene,
I understand your issue. But the links in the slider is dynamically generated from the code and always points to the very post that the featured is of. I mean slider image of post1 links to post1 and so on. But you mean to have all the slider link to the same page say Post-X. For that you have to override the theme’s function with child theme and place a static link (hard coded) in the anchor tag. And whenever you want to change the link you have to go through the code.
That is why I recommend you to upgrade to Pro.
But if you want to change it within the Free version, create a child theme. You can find more details on creating a child theme HERE. Then in child theme’sfunctions.php
add the following codes./** * Change slider's links to one custom link * */ 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"> <a title="Permalink to '.the_title('','',false).'" href=" http://your-site/link-to-some-post "> '. get_the_post_thumbnail( $post->ID, 'slider', array( 'title' => esc_attr( $title_attribute ), 'alt' => esc_attr( $title_attribute ), 'class' => 'pngfix' ) ).' </a> </figure> <div class="entry-container"> <header class="entry-header"> <h1 class="entry-title"> <a title="Permalink to '.the_title('','',false).'" href=" http://your-site/link-to-some-post ">'.the_title( '<span>','</span>', false ).'</a> </h1> </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
Note: Please replace http://your-site/link-to-some-post in the above code with your desired link. There are two occurrences.
Let me know if this helps.
Regards,
MaheshJanuary 29, 2016 at 5:32 am #84013RaieleneMemberIt works! It works! Mahesh, you’re brilliant! Thanks so much! 🙂
January 29, 2016 at 1:43 pm #84052 -
AuthorPosts
- The topic ‘All sliders link to only one page’ is closed to new replies.