'; } } add_action( 'wp_head', 'agency_ecommerce_pingback_header' ); /** * Display custom logo */ if ( ! function_exists( 'agency_ecommerce_the_custom_logo' ) ) : /** * Displays custom logo. * * @since 1.0.0 */ function agency_ecommerce_the_custom_logo() { if ( function_exists( 'the_custom_logo' ) ) { the_custom_logo(); } } endif; /** * Add go to top */ if ( ! function_exists( 'agency_ecommerce_footer_goto_top' ) ) : /** * Add Go to top. * * @since 1.0.0 */ function agency_ecommerce_footer_goto_top() { echo ''; } endif; add_action( 'wp_footer', 'agency_ecommerce_footer_goto_top' ); if ( ! function_exists( 'agency_ecommerce_implement_excerpt_length' ) ) : /** * Implement excerpt length. * * @since 1.0.0 * * @param int $length The number of words. * @return int Excerpt length. */ function agency_ecommerce_implement_excerpt_length( $length ) { $excerpt_length = agency_ecommerce_get_option( 'excerpt_length' ); if ( absint( $excerpt_length ) > 0 ) { $length = absint( $excerpt_length ); } return $length; } endif; if ( ! function_exists( 'agency_ecommerce_content_more_link' ) ) : /** * Implement read more in content. * * @since 1.0.0 * * @param string $more_link Read More link element. * @param string $more_link_text Read More text. * @return string Link. */ function agency_ecommerce_content_more_link( $more_link, $more_link_text ) { $read_more_text = agency_ecommerce_get_option( 'readmore_text' ); if ( ! empty( $read_more_text ) ) { $more_link = str_replace( $more_link_text, esc_html( $read_more_text ), $more_link ); } return $more_link; } endif; if ( ! function_exists( 'agency_ecommerce_implement_read_more' ) ) : /** * Implement read more in excerpt. * * @since 1.0.0 * * @param string $more The string shown within the more link. * @return string The excerpt. */ function agency_ecommerce_implement_read_more( $more ) { $output = $more; $read_more_text = agency_ecommerce_get_option( 'readmore_text' ); if ( ! empty( $read_more_text ) ) { $output = '…

' . esc_html( $read_more_text ) . '

'; } return $output; } endif; if ( ! function_exists( 'agency_ecommerce_hook_read_more_filters' ) ) : /** * Hook read more and excerpt length filters. * * @since 1.0.0 */ function agency_ecommerce_hook_read_more_filters() { if ( is_home() || is_category() || is_tag() || is_author() || is_date() || is_search() ) { add_filter( 'excerpt_length', 'agency_ecommerce_implement_excerpt_length', 999 ); add_filter( 'the_content_more_link', 'agency_ecommerce_content_more_link', 10, 2 ); add_filter( 'excerpt_more', 'agency_ecommerce_implement_read_more' ); } } endif; add_action( 'wp', 'agency_ecommerce_hook_read_more_filters' ); if ( ! function_exists( 'agency_ecommerce_add_sidebar' ) ) : /** * Add sidebar. * * @since 1.0.0 */ function agency_ecommerce_add_sidebar() { $global_layout = agency_ecommerce_get_option( 'global_layout' ); $global_layout = apply_filters( 'agency_ecommerce_filter_theme_global_layout', $global_layout ); // Include sidebar. if ( 'no-sidebar' !== $global_layout ) { get_sidebar(); } } endif; add_action( 'agency_ecommerce_action_sidebar', 'agency_ecommerce_add_sidebar' ); //============================================================= // Check selected category on product search //============================================================= if ( ! function_exists( 'agency_ecommerce_selected_category' ) ) { function agency_ecommerce_selected_category( $catname ) { $q_var = ( isset( $_GET['product_cat'] ) ) ? esc_html( $_GET['product_cat'] ) : ''; if ( $q_var === $catname ) { return 'selected="selected"'; } return false; } }