- This topic has 8 replies, 2 voices, and was last updated 10 years, 10 months ago by Sanjip Shah.
-
AuthorPosts
-
January 17, 2014 at 10:19 am #6413scarrollParticipant
Could you help me with removing the links on the featured slider?
This is my website http://www.christopher-dyson.co.uk It’s my first website and I’m not a coder but have been learning a bit as I go along (so far that’s very little).
I have a child theme and created a header-extensions.php file.
I then removed this line;$cleanretina_featured_post_slider .= '<figure><a href="' . get_permalink() . '" title="'.the_title('','',false).'">';
Nothing happened. Have I done the right thing and, if so, why isn’t it working
Thanks, SueJanuary 18, 2014 at 1:15 pm #6455scarrollParticipantOk I’ve worked out that as the above command is not in a template I can’t just change it in a child theme so it overrides the parent theme. I think I know what needs to be done – I need to put a command to remove the action into a functions.php file in the child theme – but am not sure how to do it
Can anybody tell me if I’m right and what command I need to put in the functions.php file?
January 22, 2014 at 8:04 am #6616Sanjip ShahParticipant@scarroll Just copy this function cleanretina_featured_post_slider in the functions.php file of you child theme and make your changes there. This is the best approach.
January 22, 2014 at 4:16 pm #6647scarrollParticipantThanks for replying.
make your changes there.
This is the bit I don’t know – what changes do I make to cleanretina_featured_post_slider? I understand I need to copy the function cleanretina_featured_post_slider into my child theme functions.php file but then I don’t know what to do with it.
I would really appreciate any help with this – it is the only thing left to do on the website and then it is ready
January 23, 2014 at 6:44 am #6665Sanjip ShahParticipant@scarroll Remove this line
<a href="' . get_permalink() . '" title="'.the_title('','',false).'">
and also the closing tag below</a>
some lines below. After that, go to Appearance->Theme Options and click in any of the ‘Save Changes’ button (no changes may reflect due to the previous cache, this is done just to delete the previous caching)January 23, 2014 at 10:44 am #6675scarrollParticipantI have made a functions.php file and pasted exactly this in it.
if ( ! function_exists( 'cleanretina_featured_post_slider' ) ) : /** * display featured post slider * * @uses set_transient and delete_transient */ function cleanretina_featured_post_slider() { global $post; global $cleanretina_theme_options_settings; $options = $cleanretina_theme_options_settings; $cleanretina_featured_post_slider = ''; if( ( !$cleanretina_featured_post_slider = get_transient( 'cleanretina_featured_post_slider' ) ) && !empty( $options[ 'featured_post_slider' ] ) ) { $cleanretina_featured_post_slider .= ' <section class="featured-slider"><div class="slider-wrap"><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"; } $cleanretina_featured_post_slider .= ' <div class="'.$classes.'">'; if( has_post_thumbnail() ) { $cleanretina_featured_post_slider .= '<figure><a href="' . get_permalink() . '" title="'.the_title('','',false).'">'; $cleanretina_featured_post_slider .= get_the_post_thumbnail( $post->ID, 'slider', array( 'title' => esc_attr( $title_attribute ), 'alt' => esc_attr( $title_attribute ), 'class' => 'pngfix' ) ).'</a></figure>'; } if( $title_attribute != '' || $excerpt !='' ) { $cleanretina_featured_post_slider .= ' <article class="featured-text">'; if( $title_attribute !='' ) { $cleanretina_featured_post_slider .= the_title( '<span>','</span>', false ); } if( $excerpt !='' ) { $cleanretina_featured_post_slider .= $excerpt.'<a href="' . get_permalink() . '" title="'.the_title('','',false).'">'.' '.__( 'Continue Reading', 'cleanretina' ).'</a>'; } $cleanretina_featured_post_slider .= ' </article><!-- .featured-text -->'; } $cleanretina_featured_post_slider .= ' </div><!-- .slides -->'; endwhile; wp_reset_query(); $cleanretina_featured_post_slider .= '</div></div> <nav id="controllers" class="clearfix"> </nav><!-- #controllers --></section><!-- .featured-slider -->'; set_transient( 'cleanretina_featured_post_slider', $cleanretina_featured_post_slider, 86940 ); } echo $cleanretina_featured_post_slider; } endif;
However the code is appearing at the top of the website (I was going to make the changes as suggested above in the child theme editor)
Am I copying the function correctly?
January 23, 2014 at 1:12 pm #6682scarrollParticipantOK, ignore my post above, I forgot to put <?php /> around the above code. The links have gone, brilliant!
Thanks very much for your help and for this wonderful themeJanuary 23, 2014 at 3:04 pm #6694scarrollParticipantthat should read <?php ?>
January 25, 2014 at 1:56 pm #6778Sanjip ShahParticipant@scarroll Okay. Great.
-
AuthorPosts
- You must be logged in to reply to this topic.