'."\n";
}
}
/**
* Extend the default WordPress body classes.
*
* @since Agama 1.0.0
* @param array $classes Existing class values.
* @return array Filtered class values.
*/
function body_class( $classes ) {
$background_color = get_background_color();
$background_image = get_background_image();
$header = get_theme_mod('agama_header_style', 'default');
$sidebar_position = get_theme_mod('agama_sidebar_position', 'right');
$blog_layout = get_theme_mod('agama_blog_layout', 'list');
// If header "sticky"
if( $header == 'sticky' ) {
$classes[] = 'sticky_header';
}
// If sidebar position "left"
if( $sidebar_position == 'left' ) {
$classes[] = 'sidebar_left';
}
// If blog layout "small_thumbs"
if( $blog_layout == 'small_thumbs' ) {
$classes[] = 'blog_small_thumbs';
}
// If blog layout "grid"
if( $blog_layout == 'grid' ) {
$classes[] = 'blog_grid';
}
// If page template "full-width"
if ( is_page_template( 'page-templates/full-width.php' ) ) {
$classes[] = 'full-width';
}
// If page template "front-page"
if ( is_page_template( 'page-templates/front-page.php' ) ) {
$classes[] = 'template-front-page';
if ( has_post_thumbnail() )
$classes[] = 'has-post-thumbnail';
}
// If empty background
if ( empty( $background_image ) ) {
if ( empty( $background_color ) )
$classes[] = 'custom-background-empty';
elseif ( in_array( $background_color, array( 'fff', 'ffffff' ) ) )
$classes[] = 'custom-background-white';
}
// Enable custom font class only if the font CSS is queued to load.
if ( wp_style_is( 'PTSans', 'queue' ) )
$classes[] = 'custom-font-enabled';
// Single Author
if ( ! is_multi_author() )
$classes[] = 'single-author';
return $classes;
}
/**
* Agama Breadcrumb
*
* @since 1.1.5
*/
public static function breadcrumb() {
global $post;
$h1 = '';
$output = '';
if( is_single() || is_page() ) {
$h1 = sprintf( '
%s
', $post->post_title );
$output = sprintf( '%s', $post->post_title );
}
if( is_archive() ) {
if ( is_day() ) :
$h1 = sprintf( '%s
%s', __( 'Daily Archives', 'agama-pro' ), get_the_date() );
$output = sprintf( '%s', __( 'Daily Archives', 'agama-pro' ) );
elseif ( is_month() ) :
$h1 = sprintf( '%s
%s', __( 'Monthly Archives', 'agama-pro' ), get_the_date( _x( 'F Y', 'monthly archives date format', 'agama-pro' ) ) );
$output = sprintf( '%s', __( 'Monthly Archives', 'agama-pro' ) );
elseif ( is_year() ) :
$h1 = sprintf( '%s
%s', __( 'Yearly Archives', 'agama-pro' ), get_the_date( _x( 'Y', 'yearly archives date format', 'agama-pro' ) ) );
$output = sprintf( '%s', __( 'Yearly Archives', 'agama-pro' ) );
else :
$h1 = __( 'Archives', 'agama-pro' );
$output = sprintf( '%s', __( 'Archives', 'agama-pro' ) );
endif;
}
if( is_category() ) {
$span = '';
if( category_description() ) {
$cat_desc = strip_tags( category_description() );
$span = sprintf( '%s', $cat_desc );
}
$category = get_the_category();
$cat_ID = $category[0]->cat_ID;
$h1 = sprintf( '%s
', single_cat_title( '', false ) ) . $span;
$output = sprintf( '%s', single_cat_title( '', false ) );
}
if( is_tag() ) {
$h1 = sprintf( '%s
', __( 'Tag', 'agama-pro' ) );
$output = sprintf( '%s', single_tag_title('', false) );
}
if( is_404() ) {
$h1 = sprintf( '%s
%s', '404', __( 'Page not Found', 'agama-pro' ) );
$output = sprintf( '%s', __( 'Page not Found', 'agama-pro' ) );
}
if( is_search() ) {
$h1 = sprintf( '%s
', __( 'Search', 'agama-pro' ) );
$output = sprintf( '%s', __( 'Search', 'agama-pro' ) );
}
// WooCommerce
if( class_exists('Woocommerce') ) {
if( is_shop() ) {
$h1 = sprintf( '%s
', __( 'Shop', 'agama-pro' ) );
$output = sprintf( '%s', __( 'Shop', 'agama-pro' ) );
}
}
if( is_home() || is_front_page() ) {
$h1 = sprintf( '%s
', __( 'Homepage', 'agama-pro' ) );
$output = '';
}
$style = get_theme_mod( 'agama_breadcrumb_style', 'mini' ) == 'mini' ? 'page-title-mini' : ''; ?>
%s', get_permalink($post->ID), __('Read More', 'agama'));
}
return;
}
/**
* Add Class to Post Edit Link
*
* @since 1.1.1
*/
function edit_post_link( $output ) {
$output = str_replace('class="post-edit-link"', 'class="button button-3d button-mini button-rounded"', $output);
return $output;
}
/**
* Add Class to Post Edit Comment Link
*
* @since 1.1.1
*/
function edit_comment_link( $output ) {
$output = str_replace('class="comment-edit-link"', 'class="button button-3d button-mini button-rounded"', $output);
return $output;
}
/**
* Render Menu Content
*
* @since 1.1.1
*/
public static function menu( $location = false, $class = false ) {
// If location not set
if( ! $location )
return;
$args = array(
'theme_location' => $location,
'menu_class' => $class,
'container' => false,
'echo' => '0'
);
$menu = wp_nav_menu( $args );
return $menu;
}
/**
* Render Social Icons
*
* @since 1.1.1
* @updated @since 1.1.2
*/
public static function sociali( $tip_position = false, $style = false ) {
// Url target
$_target = esc_attr( get_theme_mod('agama_social_url_target', '_self') );
// Social icons
$social = array(
'Facebook' => esc_url( get_theme_mod('social_facebook', '') ),
'Twitter' => esc_url( get_theme_mod('social_twitter', '') ),
'Flickr' => esc_url( get_theme_mod('social_flickr', '') ),
'Vimeo' => esc_url( get_theme_mod('social_vimeo', '') ),
'Youtube' => esc_url( get_theme_mod('social_youtube', '') ),
'Instagram' => esc_url( get_theme_mod('social_instagram', '') ),
'Pinterest' => esc_url( get_theme_mod('social_pinterest', '') ),
'Tumblr' => esc_url( get_theme_mod('social_tumblr', '') ),
'Google' => esc_url( get_theme_mod('social_google', '') ),
'Dribbble' => esc_url( get_theme_mod('social_dribbble', '') ),
'Digg' => esc_url( get_theme_mod('social_digg', '') ),
'Linkedin' => esc_url( get_theme_mod('social_linkedin', '') ),
'Blogger' => esc_url( get_theme_mod('social_blogger', '') ),
'Skype' => esc_html( get_theme_mod('social_skype', '') ),
'Forrst' => esc_url( get_theme_mod('social_forrst', '') ),
'Myspace' => esc_url( get_theme_mod('social_myspace', '') ),
'Deviantart'=> esc_url( get_theme_mod('social_deviantart', '') ),
'Yahoo' => esc_url( get_theme_mod('social_yahoo', '') ),
'Reddit' => esc_url( get_theme_mod('social_reddit', '') ),
'PayPal' => esc_url( get_theme_mod('social_paypal', '') ),
'Dropbox' => esc_url( get_theme_mod('social_dropbox', '') ),
'Soundcloud'=> esc_url( get_theme_mod('social_soundcloud', '') ),
'VK' => esc_url( get_theme_mod('social_vk', '') ),
'Email' => esc_url( get_theme_mod('social_email', '') ),
'RSS' => esc_url( get_theme_mod('social_rss', get_bloginfo('rss2_url')) )
);
if( $style == 'animated' ):
echo '';
foreach( $social as $name => $url ) {
if( ! empty( $url ) ) {
echo sprintf
(
'- %s
',
esc_attr( strtolower($name) ), $url, $_target, esc_attr( strtolower( $name ) ), esc_attr( $name )
);
}
}
echo '
';
else:
foreach( $social as $name => $url ) {
if( ! empty( $url ) ) {
echo sprintf
(
'',
esc_attr( strtolower($name) ), $url, $_target, esc_attr( $tip_position ), esc_attr( $name )
);
}
}
endif;
}
/**
* Get Post Format
*
* @since 1.1.1
*/
public static function post_format() {
$post_format = get_post_format();
switch( $post_format ) {
case 'aside':
$icon = '';
break;
case 'chat':
$icon = '';
break;
case 'gallery':
$icon = '';
break;
case 'link':
$icon = '';
break;
case 'image':
$icon = '';
break;
case 'quote':
$icon = '';
break;
case 'status':
$icon = '';
break;
case 'video':
$icon = '';
break;
case 'audio':
$icon = '';
break;
default: $icon = '';
}
return $icon;
}
/**
* Count Comments
*
* @since 1.1.1
*/
public static function comments_count() {
$comments = 0;
if( comments_open() ) {
$comments = sprintf('%s', get_comments_link(), get_comments_number() . __( ' comments', 'agama' ) );
}
return $comments;
}
/**
* Render About Author on Single Posts
*
* @since 1.1.1
*/
public static function about_author() { ?>