* @copyright (c) 2013. Novrian Y.F. * @license MIT License * @param string $sep Your custom separator */ function lsx_breadcrumbs() { if (!function_exists('yoast_breadcrumb') && !function_exists('woocommerce_breadcrumb')) { return null; } $show_on_front = get_option('show_on_front'); if ( ('posts' == $show_on_front && is_home()) || ('page' == $show_on_front && is_front_page()) ) { return; } if(function_exists('woocommerce_breadcrumb')){ ob_start(); woocommerce_breadcrumb(); $output = ob_get_clean(); $output = str_replace('woocommerce-breadcrumb', 'woocommerce-breadcrumb breadcrumbs-container', $output); }elseif(function_exists('yoast_breadcrumb')){ // Default Yoast Breadcrumbs Separator $old_sep = '\»\;'; // Get the crumbs $crumbs = yoast_breadcrumb(null, null, false); // Remove wrapper $output = preg_replace("/^\/", "", $crumbs); $output = preg_replace("/\<\/span\><\/span\>$/", "", $output); $crumb = preg_split("/\40(" . $old_sep . ")\40/", $output); $output = implode(" ", $crumb); $output = str_replace('', ' / ', $output); $output = ''; } $output = apply_filters('lsx_breadcrumbs',$output); echo wp_kses_post( $output ); } add_action( 'lsx_content_top', 'lsx_breadcrumbs', 100 ); /** * Replaces the seperator with a blank space. * */ function lsx_breadcrumbs_seperator_filter($seperator) { return ''; } add_filter( 'wpseo_breadcrumb_separator', 'lsx_breadcrumbs_seperator_filter' ); /** * Custom template tags for this theme. * Eventually, some of the functionality here could be replaced by core features. * * @package lsx */ if ( ! function_exists( 'lsx_site_title' ) ) : /** * Displays logo when applicable * * @return void */ function lsx_site_title() { ?>

%2$s'; $time_string = sprintf( $time_string, esc_attr( get_the_date( 'c' ) ), get_the_date(), esc_attr( get_the_modified_date( 'c' ) ), get_the_modified_date() ); printf( '', esc_html_x( 'Posted on:', 'Used before publish date.', 'lsx' ), esc_url( get_permalink() ), wp_kses_post( $time_string ) ); } } add_action( 'lsx_content_post_meta', 'lsx_post_meta_date', 10 ); /** * Add customisable post meta: post author */ if ( ! function_exists( 'lsx_post_meta_author' ) ) { function lsx_post_meta_author() { printf( '', esc_html_x( 'Posted by:', 'Used before post author name.', 'lsx' ), esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ), get_the_author() ); } } add_action( 'lsx_content_post_meta', 'lsx_post_meta_author', 20 ); /** * Add customisable post meta: post category(ies) */ if ( ! function_exists( 'lsx_post_meta_category' ) ) { function lsx_post_meta_category() { $post_categories = wp_get_post_categories( get_the_ID() ); $cats = array(); foreach( $post_categories as $c ) { $cat = get_category( $c ); $cats[] = '' . $cat->name . ''; } if ( ! empty( $cats ) ) { ?>
ID) { $media_array[] = $media_item->ID; } } if(!empty($media_array)){ echo wp_kses_post( gallery_shortcode( array( 'size' => 'full', 'ids' => implode( ',', $media_array ) ) ) ); } } } } if ( ! function_exists( 'lsx_paging_nav' ) ) : /** * Display navigation to next/previous set of posts when applicable. * * @return void */ function lsx_paging_nav() { // Don't print empty markup if there's only one page. if ( $GLOBALS['wp_query']->max_num_pages < 2 ) { return; } if(current_theme_supports('infinite-scroll') && class_exists('The_Neverending_Home_Page')){ return true; }elseif(function_exists('wp_pagenavi')){ wp_pagenavi(); }else{ $labels = array( 'next' => ' '.esc_html__( 'Older posts', 'lsx' ), 'previous' => esc_html__( 'Newer posts', 'lsx' ).' ', 'title' => esc_html__( 'Posts navigation', 'lsx' ) ); $labels = apply_filters('lsx_post_navigation_labels',$labels); ?> post_parent ) : get_adjacent_post( false, '', true ); $next = get_adjacent_post( false, '', false ); if ( ! $next && ! $previous ) { return; } ?> 'page', 'posts_per_page'=> 99, 'post_status' => 'publish', 'post_type' => 'page', ); $pages = new WP_Query($page_args); if($pages->have_posts()){ echo '

' . esc_html__( 'Pages', 'lsx' ) . '

'; echo ''; wp_reset_postdata(); } } /** * Outputs a custom post type section * * @package lsx * @subpackage template-tags * @category sitemap */ function lsx_sitemap_custom_post_type(){ $args = array( 'public' => true, '_builtin' => false ); $post_types = get_post_types($args , 'names'); foreach($post_types as $post_type){ $post_type_args = array( 'post_type' => 'page', 'posts_per_page'=> 99, 'post_status' => 'publish', 'post_type' => $post_type, ); $post_type_items = new WP_Query($post_type_args); $post_type_object = get_post_type_object($post_type); if(null != $post_type_object){ $title = $post_type_object->labels->name; }else{ $title = ucwords($post_type); } if($post_type_items->have_posts()){ echo '

' . esc_html( $title ) . '

'; echo ''; wp_reset_postdata(); } } } /** * Outputs the public taxonomies * * @package lsx * @subpackage template-tags * @category sitemap */ function lsx_sitemap_taxonomy_clouds(){ $taxonomy_args = array( 'public' => true, '_builtin' => false ); $taxonomies = get_taxonomies($taxonomy_args); if(!empty($taxonomies)){ foreach($taxonomies as $taxonomy_id => $taxonomy) { $tag_cloud = wp_tag_cloud(array('taxonomy'=>$taxonomy_id,'echo'=>false)); if(null != $tag_cloud){ echo '

' . esc_html( $taxonomy ) . '

'; echo ''; } } } } /** * Adds subscribe form above footer * * @package lsx * @subpackage hooks * @category forms */ add_action( 'lsx_footer_before', 'lsx_footer_subscription_cta', 10 ); function lsx_footer_subscription_cta() { if(!function_exists('lsx_is_form_enabled')){ return; } $subscribe_form_id = lsx_is_form_enabled('subscribe'); if(false == $subscribe_form_id) { return; } //add Caldera Forms Fields Scripts if( defined( 'CFCORE_VER' ) ){ wp_enqueue_script( 'cf-frontend-fields', CFCORE_URL . 'assets/js/fields.min.js', array('jquery'), CFCORE_VER ); } ?>
$form_maybe){ if( trim(strtolower($slug)) == strtolower($form_maybe['name']) ){ $match = $form_id; break; } } } if( false === $match ){ $is_form = Caldera_Forms::get_form( strtolower( $slug ) ); if( !empty( $is_form ) ){ return strtolower( $slug ); } } return $match; } } /** * Return URL from a link in the content * * @package lsx * @subpackage extras * @category urls */ function lsx_get_my_url() { if ( ! preg_match( '/]*?href=[\'"](.+?)[\'"]/is', get_the_content(), $matches ) ) return false; return esc_url_raw( $matches[1] ); } /** * Return URL from a link in the content * * @package lsx * @subpackage extras * @category urls */ function lsx_get_template_part($slug,$part) { $template = array(); $part = (string) $part; if ( '' !== $part ){ $template = "{$slug}-{$part}.php"; }else{ $template = "{$slug}.php"; } $file_path = apply_filters('lsx_content_path',false,$slug,$part); if ( false !== $file_path && '' == locate_template( array( $template ) ) && file_exists( $file_path.$template) ) { load_template( $file_path.$template, false ); }else{ get_template_part($slug,$part); } }