| Server IP : 172.67.166.150 / Your IP : 216.73.216.182 Web Server : LiteSpeed System : Linux pbn-16.isgood.host 5.15.0-164-generic #174-Ubuntu SMP Fri Nov 14 20:25:16 UTC 2025 x86_64 User : gamenohushop ( 1160) PHP Version : 8.1.32 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /usr/local/lsws/gamenohu.shop/html/wp-content/themes/flatsome/inc/shortcodes/ |
Upload File : |
<?php
/**
* Registers the `scroll_to` shortcode.
*
* @package flatsome
*/
/**
* Renders the `scroll_to` shortcode.
*
* @param array $atts An array of attributes.
* @param string $content The shortcode content.
* @param string $tag The name of the shortcode, provided for context to enable filtering.
*
* @return string
*/
function flatsome_scroll_to( $atts, $content = null, $tag = '' ) {
$atts = shortcode_atts( array(
'bullet' => 'true',
'title' => 'Change this',
'link' => '',
'offset_type' => '',
'offset' => '0',
), $atts, $tag );
if ( ! $atts['title'] && ! $atts['link'] ) {
return false;
}
// Convert title to link if link is not set.
if ( ! $atts['link'] ) {
$atts['link'] = flatsome_to_dashed( $atts['title'] );
}
if ( substr( $atts['link'], 0, 1 ) !== '#' ) {
$atts['link'] = '#' . $atts['link'];
}
$element_atts = array(
'class' => 'scroll-to',
'data-label' => esc_attr( 'Scroll to: ' . $atts['link'] ),
'data-bullet' => esc_attr( $atts['bullet'] ),
'data-link' => esc_attr( $atts['link'] ),
'data-title' => esc_attr( $atts['title'] ),
);
if ( $atts['offset_type'] === 'custom' ) {
$element_atts['data-offset-type'] = $atts['offset_type'];
$element_atts['data-offset'] = esc_attr( $atts['offset'] );
}
return sprintf( '<span %s><a name="%s"></a></span>',
flatsome_html_atts( $element_atts ),
esc_attr( str_replace( '#', '', $atts['link'] ) )
);
}
add_shortcode( 'scroll_to', 'flatsome_scroll_to' );