'', 'id' => '', 'blog_grid_column_spacing' => '40', 'blog_grid_columns' => '3', 'cat_slug' => '', 'excerpt' => 'yes', 'excerpt_length' => '', 'excerpt_words' => '50', //deprecated 'exclude_cats' => '', 'layout' => 'large', 'meta_all' => 'yes', 'meta_author' => 'yes', 'meta_categories' => 'yes', 'meta_comments' => 'yes', 'meta_date' => 'yes', 'meta_link' => 'yes', 'meta_read' => 'yes', 'meta_tags' => 'no', 'number_posts' => '', 'order' => 'DESC', 'paging' => 'yes', 'scrolling' => 'infinite', 'strip_html' => 'yes', 'thumbnail' => 'yes', 'title' => 'yes', 'title_link' => 'yes', 'nopaging' => false, //deprecated 'posts_per_page' => '-1', 'taxonomy' => 'category' ), $args ); extract( $defaults ); if( is_front_page() || is_home() ) { $paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : ( ( get_query_var( 'page' ) ) ? get_query_var( 'page' ) : 1 ); } else { $paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1; } $defaults['paged'] = $paged; // covert all attributes to correct values for WP query if( $defaults['number_posts'] ) { $defaults['posts_per_page'] = $defaults['number_posts']; } if( $defaults['posts_per_page'] == -1 ) { $defaults['nopaging'] = true; } ( $defaults['excerpt'] == "yes" ) ? ( $defaults['excerpt'] = true ) : ( $defaults['excerpt'] = false ); ( $defaults['meta_all'] == "yes" ) ? ( $defaults['meta_all'] = true ) : ( $defaults['meta_all'] = false ); ( $defaults['meta_author'] == "yes" ) ? ( $defaults['meta_author'] = true ) : ( $defaults['meta_author'] = false ); ( $defaults['meta_categories'] == "yes" ) ? ( $defaults['meta_categories'] = true ) : ( $defaults['meta_categories'] = false ); ( $defaults['meta_comments'] == "yes" ) ? ( $defaults['meta_comments'] = true) : ( $defaults['meta_comments'] = false ); ( $defaults['meta_date'] == "yes" ) ? ( $defaults['meta_date'] = true ) : ( $defaults['meta_date'] = false ); ( $defaults['meta_link'] == "yes" ) ? ( $defaults['meta_link'] = true ) : ( $defaults['meta_link'] = false ); ( $defaults['meta_tags'] == "yes" ) ? ( $defaults['meta_tags'] = true ) : ( $defaults['meta_tags'] = false ); ( $defaults['paging'] == "yes" ) ? ( $defaults['paging'] = true ) : ( $defaults['paging'] = false ); ( $defaults['scrolling'] == "infinite" ) ? ( $defaults['paging'] = true ) : ( $defaults['paging'] = $defaults['paging'] ); ( $defaults['strip_html'] == "yes" ) ? ( $defaults['strip_html'] = true ) : ( $defaults['strip_html'] = false ); ( $defaults['thumbnail'] == "yes" ) ? ( $defaults['thumbnail'] = true ) : ( $defaults['thumbnail'] = false ); ( $defaults['title'] == "yes" ) ? ( $defaults['title'] = true ) : ( $defaults['title'] = false ); ( $defaults['title_link'] == "yes" ) ? ( $defaults['title_link'] = true ) : ( $defaults['title_link'] = false ); if( $defaults['excerpt_length'] || $defaults['excerpt_length'] === '0' ) { $defaults['excerpt_words'] = $defaults['excerpt_length']; } //check for cats to exclude; needs to be checked via exclude_cats param and '-' prefixed cats on cats param //exclution via exclude_cats param $cats_to_exclude = explode( ',' , $defaults['exclude_cats'] ); $cats_id_to_exclude = array(); if( $cats_to_exclude ) { foreach( $cats_to_exclude as $cat_to_exclude ) { $id_obj = get_category_by_slug( $cat_to_exclude ); if( $id_obj ) { $cats_id_to_exclude[] = $id_obj->term_id; } } if( $cats_id_to_exclude ) { $defaults['category__not_in'] = $cats_id_to_exclude; } } //setting up cats to be used and exclution using '-' prefix on cats param; transform slugs to ids $cat_ids =''; $categories = explode( ',' , $defaults['cat_slug'] ); if ( isset( $categories ) && $categories ) { foreach ( $categories as $category ) { $id_obj = get_category_by_slug( $category ); if( $id_obj ) { if( strpos( $category, '-' ) === 0 ) { $cat_ids .= '-' . $id_obj->cat_ID . ','; } else { $cat_ids .= $id_obj->cat_ID . ','; } } } } $defaults['cat'] = substr( $cat_ids, 0, -1 ); if( $defaults['blog_grid_column_spacing'] === '0' ) { $defaults['blog_grid_column_spacing'] = '0.0'; } self::$args = $defaults; $fusion_query = new WP_Query( $defaults ); $this->query = $fusion_query; //prepare needed wrapping containers $html = ''; $html .= sprintf( '
', FusionCore_Plugin::attributes( 'blog-shortcode-entry-meta-details' ) ); if( self::$args['meta_author'] ) { $inner_content .= sprintf( '%s %s' . '|', __( 'By', 'fusion-core' ), FusionCore_Plugin::attributes( 'blog-shortcode-meta-author' ), FusionCore_Plugin::attributes( 'blog-shortcode-meta-author-link' ), get_the_author_meta( 'display_name' ), FusionCore_Plugin::attributes( 'meta-separator' ) ); } if( self::$args['meta_date'] ) { $updated = ''; if( ! $smof_data['disable_date_rich_snippet_pages'] ) { $updated = sprintf( '%s', FusionCore_Plugin::attributes( 'blog-shortcode-meta-date-updated' ), get_the_modified_time( 'c' ) ); } $inner_content .= sprintf( '%s|', FusionCore_Plugin::attributes( 'entry-time' ), $updated, FusionCore_Plugin::attributes( 'blog-shortcode-meta-date' ), get_the_time( $smof_data['date_format'] ), FusionCore_Plugin::attributes( 'meta-separator' ) ); } if( $return_all_meta ) { if( self::$args['meta_categories'] ) { $categories = get_the_category(); $no_of_categories = count( $categories ); $separator = ', '; $output = ''; if( self::$args['meta_tags'] ) { $output = __( 'Categories:', 'fusion-core' ) . ' '; } $count = 1; foreach( $categories as $category ) { $output .= 'name ) ) . '">'.$category->cat_name.''; if( $count < $no_of_categories ) { $output .= $separator; } $count++; } $inner_content .= sprintf( '%s|', FusionCore_Plugin::attributes( 'entry-categories' ), $output, FusionCore_Plugin::attributes( 'meta-separator' ) ); } if( self::$args['meta_tags'] ) { $inner_content .= $this->post_meta_tags(); } if( self::$args['meta_comments'] ) { ob_start(); comments_popup_link( __( '0 Comments', 'fusion-core' ), __( '1 Comment', 'fusion-core' ), '% ' . __( 'Comments', 'fusion-core' ) ); $comments = ob_get_contents(); ob_get_clean(); $inner_content .= sprintf( '%s|', FusionCore_Plugin::attributes( 'entry-comments' ), $comments, FusionCore_Plugin::attributes( 'meta-separator' ) ); } } $inner_content .= '
'; return $inner_content; } // end post_meta_data() function grid_timeline_comments() { if( self::$args['meta_comments'] ) { $comments_icon = sprintf( ' ', FusionCore_Plugin::attributes( 'fusionicon-bubbles' ) ); ob_start(); comments_popup_link( $comments_icon . __( '0', 'fusion-core' ), $comments_icon . __( '1', 'fusion-core' ), $comments_icon . __( '%', 'fusion-core' ) ); $comments = ob_get_contents(); ob_get_clean(); $inner_content = sprintf( '%s
', FusionCore_Plugin::attributes( 'entry-comments' ), $comments ); return $inner_content; } } // end grid_timeline_comments() function post_meta_tags() { $inner_content = ''; if( self::$args['meta_tags'] ) { ob_start(); the_tags( '' ); $tags = ob_get_contents(); ob_get_clean(); if( $tags ) { $inner_content = sprintf( '%s %s|', FusionCore_Plugin::attributes( 'blog-shortcode-meta-tags' ), __( 'Tags:', 'fusion-core' ), $tags, FusionCore_Plugin::attributes( 'meta-separator' ) ); } } return $inner_content; } // end post_meta_tags() function read_more() { if( self::$args['meta_link'] ) { $inner_content = ''; if( self::$args['meta_read'] ) { $inner_content .= sprintf( '', FusionCore_Plugin::attributes( 'entry-read-more' ) ); $inner_content .= sprintf( '%s', get_permalink(), __( 'Read More', 'fusion-core' ) ); $inner_content .= '
'; } return $inner_content; } } // end read_more() function entry_meta_attr() { global $smof_data; $attr = array(); $vcard = ''; if( ! $smof_data['disable_date_rich_snippet_pages'] ) { $vcard = ' vcard'; } if( self::$args['layout'] == 'grid' || self::$args['layout'] == 'timeline' ) { $attr['class'] = 'entry-meta-single' . $vcard; } else { $attr['class'] = 'entry-meta' . $vcard; } return $attr; } // end entry_meta_attr(); function entry_meta_details_attr() { $attr = array(); $attr['class'] = 'entry-meta-details'; return $attr; } // end entry_meta_attr(); function meta_tags_attr() { $attr = array(); $attr['class'] = 'meta-tags'; return $attr; } // end meta_tags_attr(); function meta_author_attr() { global $smof_data; $attr = array(); if( ! $smof_data['disable_date_rich_snippet_pages'] ) { $attr['class'] = 'entry-author fn'; } else { $attr['class'] = 'entry-author'; } if( current_theme_supports( 'fusion-schema' ) ) { $attr['itemprop'] = 'author'; $attr['itemscope'] = 'itemscope'; $attr['itemtype'] = 'http://schema.org/Person'; } return $attr; } // end meta_author_attr(); function meta_author_link_attr() { $attr = array(); $attr['href'] = get_author_posts_url( get_the_author_meta( 'ID' ) ); $attr['rel'] = 'author'; if( current_theme_supports( 'fusion-schema' ) ) { $attr['itemprop'] = 'url'; } return $attr; } // end meta_author_link_attr(); function meta_date_attr() { $attr = array(); $attr['class'] = 'published'; $attr['datetime'] = get_the_time( 'c' ); return $attr; } // end meta_date_attr(); function meta_date_updated_attr() { $attr = array(); $attr['class'] = 'updated'; $attr['style'] = 'display:none;'; return $attr; } // end meta_date_attr(); function loop_content() { // get the post content according to the chosen kind of delivery if( self::$args['excerpt'] ) { $content = tf_content( self::$args['excerpt_words'], self::$args['strip_html'] ); } else { $content = get_the_content(); $content = apply_filters( 'the_content', $content ); $content = str_replace( ']]>', ']]>', $content ); } echo $content; } // end loop_content() function page_links() { avada_link_pages(); } // end page_links() } new FusionSC_Blog();