( 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( '%1$s>', $tag );
}
$logo = sprintf( '%4$s', $link, esc_attr( strip_tags
( $title ) ), ( $brand ) ? ' class="brand"' : '', ( $img ) ? '
' : $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 '
- Follow Us:
';
echo spyropress_content_social_icons( $socials );
echo '
';
}
function spyropress_page_social_icons( $id = ''){
echo '';
echo spyropress_content_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;
}
function spyropress_site_main_section() {
$class = get_setting( 'theme_layout' );
echo '';
}
add_action( 'spyropress_wrapper' , 'spyropress_site_main_section' );
function spyropress_site_main_section_end(){
echo '
';
}
add_action( 'spyropress_wrapper_end' , 'spyropress_site_main_section_end' );
function spyropress_header_slider(){
$v = '';
if( 'v4' == spyropress_header_style() ):
$options = get_post_meta( get_the_ID(), '_page_options', true );
$v = ( isset( $options['slider'] ) && !empty( $options['slider'] ) )? '' : '2';
endif;
spyropress_get_template_part( 'part=templates/slider'.$v );
}
$version = spyropress_header_style();
if( 'v2' == $version || 'v1' == $version )
add_action( 'spyropress_after_header' , 'spyropress_header_slider' );
if( 'v4' == $version )
add_action( 'spyropress_before_header' , 'spyropress_header_slider' );
function spyropress_header_style(){
$url = explode('?', 'http://'.$_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"]);
$postID = url_to_postid($url[0]);
$page_options = get_post_meta( $postID, '_page_options', true );
$version = ( isset( $page_options['page_header'] ) && !empty( $page_options['page_header'] ) && $page_options['page_header'] != 'default' )? $page_options['page_header'] : get_setting( 'header_style', 'v1' );
return $version;
}
?>