ID; $count_key = '_post_views_count'; $count = get_post_meta( $postID, $count_key, true ); $count = ( $count ) ? $count : 0; return sprintf( _n( '%d ' . $singular, '%d ' . $plural, $count , 'spyropress'), $count ); } /** * Logo * Get logo from theme options or pass custom logo */ function spyropress_logo( $args = '', $content = '' ) { echo spyropress_get_logo( $args, $content ); } function spyropress_get_logo( $args = '', $content = '' ) { $defaults = array( 'tag' => ( is_front_page() || is_home() ) ? 'h1' : 'div', 'class' => 'logo', 'id' => 'logo', 'link' => esc_url( home_url( '/' ) ), 'alt' => get_bloginfo( 'name' ), 'title' => get_bloginfo( 'name' ), 'show_img' => !get_setting( 'texttitle', false ), 'img' => get_setting( 'logo', false ), 'brand' => false, 'before' => '', 'after' => '' ); $args = wp_parse_args( $args, $defaults ); extract( $args, EXTR_SKIP ); if ( !$brand ) { $before = sprintf( '<%1$s class="%2$s" id="%3$s">', $tag, $class, $id ); $after = sprintf( '', $tag ); } $logo = sprintf( '%4$s', $link, esc_attr( strip_tags ( $title ) ), ( $brand ) ? ' class="brand"' : '', ( $img ) ? '' . $alt . '' : $title ); return $before . $logo . $after; } /** * Get menu with Bootstrap Walker */ function spyropress_get_nav_menu( $args = '', $location = 'primary' ) { if( !has_nav_menu( $location ) ) return; $defaults = array( 'theme_location' => $location, 'container' => 'nav', 'container_class' => 'navbar', 'container_id' => $location . '-nav', 'menu_class' => 'nav', 'walker' => new Bootstrapwp_Walker_Nav_Menu ); return wp_nav_menu( wp_parse_args( $args, $defaults ) ); } /** * the_content */ function spyropress_the_content( $post_id = '' ) { echo spyropress_get_the_content( $post_id ); } function spyropress_get_the_content( $post_id = '' ) { if ( class_exists( 'SpyropressBuilder' ) && spyropress_has_builder_content( $post_id ) ) { spyropress_the_builder_content( $post_id ); } elseif ( is_singular() ) { ob_start(); echo '
'; $page_options = get_post_meta( get_the_ID(), '_page_options', true ); $layout = ( isset( $page_options['layout_type'] ) && !empty( $page_options['layout_type'] ) ) ? $page_options['layout_type'] : ''; get_template_part( 'templates/page-content', $layout ); echo '
'; echo '
'; return ob_get_clean(); } else { return get_the_excerpt(); } } /** * Related Post */ function spyropress_related_post( $args = array() ) { if ( !is_singular() ) return; spyropress_get_template_part( 'part=templates/related-posts' ); } /** * Author Box */ function spyropress_authorbox() { spyropress_get_template_part( 'part=templates/author-box' ); } function spyropress_post_format_icon( $format = 'standard' ) { switch( $format ) { case 'gallery': echo ''; break; case 'image': echo ''; break; case 'quote': echo ''; break; case 'video': echo ''; break; case 'chat': echo ''; break; case 'audio': echo ''; break; case 'link': echo ''; break; default: echo ''; break; } } function spyropress_social_icons( $id = '' ) { if( empty( $id ) ) return; $socials = get_setting_array( $id ); if( empty( $socials ) ) return; $icons = array( 'yt' => 'icon-youtube', 'fb' => 'icon-facebook', 'tw' => 'icon-twitter', 'lin' => 'icon-linkedin', 'gl' => 'icon-google-plus', 'dr' => 'icon-dribbble', 'sk' => 'icon-skype', 'rss' => 'icon-rss', 'pt' => 'icon-pinterest', 'tl' => 'icon-tumblr', 'is' => 'icon-instagram', 'vk' => 'icon-vk', 'dx' => 'icon-dropbox', 'fs' => 'icon-foursquare', 'gh' => 'icon-github-alt', 'mx' => 'icon-maxcdn', 'env' => 'icon-envelope', ); echo '
'; foreach( $socials as $social ) echo ''; echo '
'; } function spyropress_footer_social_icons( $id = '' ) { if( empty( $id ) ) return; $socials = get_setting_array( $id ); if( empty( $socials ) ) return; echo ''; } function spyropress_page_social_icons( $id = ''){ echo ''; } function spyropress_content_social_icons( $contents = '' ) { if( empty( $contents ) ) return; $icons = array( 'yt' => 'icon-youtube', 'fb' => 'icon-facebook', 'tw' => 'icon-twitter', 'lin' => 'icon-linkedin', 'gl' => 'icon-google-plus', 'dr' => 'icon-dribbble', 'sk' => 'icon-skype', 'rss' => 'icon-rss', 'pt' => 'icon-pinterest', 'tl' => 'icon-tumblr', 'is' => 'icon-instagram', 'vk' => 'icon-vk', 'dx' => 'icon-dropbox', 'fs' => 'icon-foursquare', 'gh' => 'icon-github-alt', 'mx' => 'icon-maxcdn', 'env' => 'icon-envelope', ); $social_icons = ''; foreach( $contents as $content ){ $url = ''; $url = ( isset($content['ft_url'] ) )? $content['ft_url'] : ''; $url = ( isset($content['url'] ) )? $content['url'] : ''; $social_icons .= '
  • '; } return $social_icons; }