Home › Forums › Pro Themes › Onefold Pro › Links on slider pictures
Tagged: slider
- This topic has 3 replies, 2 voices, and was last updated 8 years, 3 months ago by
wensolutions.
-
AuthorPosts
-
December 31, 2016 at 10:59 am #27108
MarcoAix
ParticipantHello,
I would like to simply remove the link (towards the post) on the slider pictures.
I’m used to deal with code, so I guess it’s in “onefold-pro/inc/hook/slider.php” but I’m not sure what to do exactly.
Thanks for helping me.
MarcoJanuary 1, 2017 at 10:25 pm #27155wensolutions
KeymasterHello @MarcoAix,
While the path you have given to the file for slider is correct, we do not suggest editing the theme files itself.
The changes made directly to the theme files will be lost upon update. Hence, we would suggest child theme implementation for your desired result. To learn about child themes see the link here : https://codex.wordpress.org/Child_Themes.
You can also automate the child theme creation with the child theme generator plugin.
After creation and activation of the child theme, please paste in the following code block in your child theme’s functions.php file :
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersfunction onefold_render_featured_slider( $slider_details = array() ) { if ( empty( $slider_details ) ) { return; } $featured_slider_transition_effect = onefold_get_option( 'featured_slider_transition_effect' ); $featured_slider_enable_caption = onefold_get_option( 'featured_slider_enable_caption' ); $featured_slider_enable_arrow = onefold_get_option( 'featured_slider_enable_arrow' ); $featured_slider_enable_pager = onefold_get_option( 'featured_slider_enable_pager' ); $featured_slider_enable_autoplay = onefold_get_option( 'featured_slider_enable_autoplay' ); $featured_slider_transition_duration = onefold_get_option( 'featured_slider_transition_duration' ); $featured_slider_transition_delay = onefold_get_option( 'featured_slider_transition_delay' ); // Cycle data. $slide_data = array( 'fx' => esc_attr( $featured_slider_transition_effect ), 'speed' => esc_attr( $featured_slider_transition_duration ) * 1000, 'pause-on-hover' => 'true', 'loader' => 'true', 'log' => 'false', 'swipe' => 'true', 'auto-height' => 'container', ); if ( $featured_slider_enable_caption ) { $slide_data['caption-template'] = '<div class="container"><div class="caption-wrap"><h3><a href="{{url}}" target="{{target}}">{{title}}</a></h3><p>{{excerpt}}</p>{{buttons}}</div></div>'; } if ( $featured_slider_enable_pager ) { $slide_data['pager-template'] = '<span class="pager-box">{{slideNum}}</span>'; } if ( $featured_slider_enable_autoplay ) { $slide_data['timeout'] = absint( $featured_slider_transition_delay ) * 1000; } else { $slide_data['timeout'] = 0; } $slide_data['slides'] = 'article'; $slide_attributes_text = ''; foreach ( $slide_data as $key => $item ) { $slide_attributes_text .= ' '; $slide_attributes_text .= ' data-cycle-'.esc_attr( $key ); $slide_attributes_text .= '="'.esc_attr( $item ).'"'; } ?> <div id="featured-slider"> <div class="cycle-slideshow" id="main-slider" <?php echo $slide_attributes_text; ?>> <?php if ( $featured_slider_enable_arrow ) : ?> <!-- prev/next links --> <div class="cycle-prev"><i class="fa fa-angle-left" aria-hidden="true"></i></div> <div class="cycle-next"><i class="fa fa-angle-right" aria-hidden="true"></i></div> <?php endif; ?> <?php if ( $featured_slider_enable_pager ) : ?> <!-- pager --> <div class="cycle-pager"></div> <?php endif; ?> <?php if ( $featured_slider_enable_caption ) : ?> <!-- empty element for caption --> <div class="cycle-caption"></div> <?php endif; ?> <?php $cnt = 1; ?> <?php foreach ( $slider_details as $key => $slide ) : ?> <?php $class_text = ( 1 === $cnt ) ? 'first' : ''; ?> <?php $target = '_self'; if ( isset( $slide['new_window'] ) && 1 === $slide['new_window'] && ! empty( $slide['url'] ) ) { $target = '_blank'; } $url = 'javascript:void(0);'; if ( ! empty( $slide['url'] ) ) { $url = esc_url( $slide['url'] ); } // Fixing title. $title = htmlspecialchars_decode( $slide['title'] ); $exploded = explode( '<br>', $title ); if ( ! empty( $exploded ) ) { $first_part = array_shift( $exploded ); $exploded = array_filter( array_map( 'trim', $exploded ) ); $second_part = implode( ' ', $exploded ); $title = $first_part . '<span>' . $second_part . '</span>'; } $title = htmlspecialchars( $title ); // Buttons stuff. $buttons_markup = ''; $primary_button_text = ! empty( $slide['primary_button_text'] ) ? $slide['primary_button_text'] : '' ; $primary_button_url = ! empty( $slide['primary_button_url'] ) ? $slide['primary_button_url'] : '' ; $secondary_button_text = ! empty( $slide['secondary_button_text'] ) ? $slide['secondary_button_text'] : '' ; $secondary_button_url = ! empty( $slide['secondary_button_url'] ) ? $slide['secondary_button_url'] : '' ; if ( ! empty( $primary_button_text ) || ! empty( $secondary_button_text ) ) { $buttons_markup .= '<div class="slider-buttons">'; if ( ! empty( $primary_button_text ) ) { $buttons_markup .= '<a href="' . esc_url( $primary_button_url ) . '" class="custom-button slider-button button-primary">' . esc_html( $primary_button_text ) . '</a>'; } if ( ! empty( $secondary_button_text ) ) { $buttons_markup .= '<a href="' . esc_url( $secondary_button_url ) . '" class="custom-button slider-button button-secondary">' . esc_html( $secondary_button_text ) . '</a>'; } $buttons_markup .= '</div>'; } ?> <article class="<?php echo esc_attr( $class_text ); ?>" data-cycle-title="<?php echo esc_attr( $title ); ?>" data-cycle-url="<?php echo esc_url( $url ); ?>" data-cycle-excerpt="<?php echo esc_attr( $slide['excerpt'] ); ?>" data-cycle-target="<?php echo esc_attr( $target ); ?>" data-cycle-buttons="<?php echo esc_attr( $buttons_markup ); ?>" > <img src="<?php echo esc_url( $slide['images'][0]); ?>" alt="<?php echo esc_attr( $slide['title'] ); ?>" /> </article> <?php $cnt++; ?> <?php endforeach; ?> </div><!-- #main-slider --> </div><!-- #featured-slider --> <?php } This will remove the links from the slider image in the featured front page slider.
Hope this Helps,
Best Regards !!
January 2, 2017 at 11:09 am #27264MarcoAix
ParticipantHi,
Oh yes, I forgot mentioning that I already created a child theme.
Wow, I couldn’t have guessed so many code lines: thank you so much, it works perfectly.
By the way, your theme is very complete and well done.
Happy new year !
Best regards,
MarcoJanuary 2, 2017 at 10:27 pm #27329wensolutions
KeymasterGlad we could help you,
For any further queries and issues in the future please feel free to post in your queries here.
Happy New Year !! 🙂
-
AuthorPosts
- You must be logged in to reply to this topic.