', esc_url( get_bloginfo( 'pingback_url' ) ) ); } } add_action( 'wp_head', 'paddle_pingback_header' ); /** * Add a dropdown icon to top-level menu items. * * @param string $output Nav menu item start element. * @param object $item Nav menu item. * @param int $depth Depth. * @param object $args Nav menu args. * @return string Nav menu item start element. * Add a dropdown icon to top-level menu items */ function paddle_nav_add_dropdown_icons( $output, $item, $depth, $args ) { // Only add class to 'top level' items on the 'primary' menu. if ( ! isset( $args->theme_location ) || 'primary' !== $args->theme_location ) { return $output; } if ( in_array( 'menu-item-has-children', $item->classes, true ) ) { ob_start(); ?> element of the menu item targeted. $output .= $custom_sub_menu_html; } return $output; } add_filter( 'walker_nav_menu_start_el', 'paddle_nav_add_dropdown_icons', 10, 4 ); /** * Generate custom search form * * @param string $form Form HTML. * @return string Modified form HTML. */ function paddle_search_form( $form ) { $form = '
'; return $form; } add_filter( 'get_search_form', 'paddle_search_form' ); /** * @usage: For Minimizing dynamic CSS */ function paddle_minimize_css( $css ) { $css = preg_replace( '/\/\*((?!\*\/).)*\*\//', '', $css ); $css = preg_replace( '/\s{2,}/', ' ', $css ); $css = preg_replace( '/\s*([:;{}])\s*/', '$1', $css ); $css = preg_replace( '/;}/', '}', $css ); return $css; } /** * paddle_layout_container * * @param mixed $layout * @return void */ function paddle_layout_container( $layout = '' ) { $paddle_sidebar_layout_option = absint( get_theme_mod( 'paddle_page_layout_sidebar', 1 ) ); $col_8 = 'col-lg-8'; $col_4 = 'col-lg-4'; if ( class_exists( 'woocommerce' ) ) { if ( is_woocommerce() ) { $col_8 = 'col-lg-9'; } } if ( class_exists( 'woocommerce' ) ) { if ( is_woocommerce() ) { $col_4 = 'col-lg-3'; } } if ( 'content' === $layout ) : $paddle_container = ( 0 === $paddle_sidebar_layout_option ) ? 'col-lg-12' : ( ( 1 === $paddle_sidebar_layout_option ) ? $col_8 : '' ); else : $paddle_container = ( 0 === $paddle_sidebar_layout_option ) ? 'col-lg-12' : ( ( 1 === $paddle_sidebar_layout_option ) ? $col_4 : '' ); endif; return $paddle_container; } /** * paddle_layout_width * * @return void */ function paddle_layout_width() { $paddle_full_page_width = absint( get_theme_mod( 'paddle_page_layout_width', 1 ) ); $paddle_page_width_option = ( 0 === $paddle_full_page_width ) ? '' : ( ( 1 === $paddle_full_page_width ) ? 'full-width-content' : '' ); return $paddle_page_width_option; } /** * paddle_add_cta_menu * Add extra list item to menu items * * @param mixed $items * @param mixed $args * @return void */ function paddle_add_cta_menu( $items, $args ) { if ( 'primary' === $args->theme_location && 1 === absint( get_theme_mod( 'paddle_header_cta', 0 ) ) ) { $option_url = get_theme_mod( 'paddle_header_cta_url', home_url() ); $option_text = get_theme_mod( 'paddle_header_cta_text', ' CTA TEXT ' ); $url = esc_url( $option_url ); if ( ! empty( $option_url ) && ! empty( $option_text ) ) { $items .= '