';
}
$desktop = esc_url( get_theme_mod( 'agama_logo', '' ) );
$tablet = esc_url( get_theme_mod( 'agama_tablet_logo', '' ) );
$mobile = esc_url( get_theme_mod( 'agama_mobile_logo', '' ) );
if( ! empty( $desktop ) ) {
$logo['desktop'] = $desktop;
}
if( ! empty( $tablet ) ) {
$logo['tablet'] = $tablet;
}
if( ! empty( $mobile ) ) {
$logo['mobile'] = $mobile;
}
if( ! empty( $logo ) ) {
$output .= '';
foreach( $logo as $device => $url ) {
$output .= '
';
}
$output .= '';
} else {
$output .= '
';
// Tagline
if( get_theme_mod( 'agama_header_style', 'agama_header_style' ) == 'default' ) {
$output .= ''. get_bloginfo( 'description' ) .'
';
}
}
if( is_customize_preview() ) {
$output .= '';
}
return $output;
}
}
/**
* Header Style
*
* Get current header style.
*
* @since 1.6.1
* @return string
*/
function agama_header_style() {
$style = get_theme_mod( 'agama_header_style', 'transparent' );
return esc_attr( $style );
}
/**
* Sidebar Position
*
* Return sidebar position setting.
*
* @return string
*/
function agama_sidebar_position() {
$setting = get_theme_mod( 'agama_sidebar_position', 'right' );
if( empty( $setting ) ) {
return;
}
return esc_attr( $setting );
}
/**
* Agama Thumb Title
* Get post-page article title and separates it on two halfs
*
* @since 1.0.1
* @return string
*/
function agama_thumb_title() {
$title = get_the_title();
$findme = ' ';
$pos = strpos($title, $findme);
if( $pos === false ) {
$output = ''.$title.'
';
} else {
// isolate part 1 and part 2.
$title_part_one = strstr($title, ' ', true); // As of PHP 5.3.0
$title_part_two = strstr($title, ' ');
$output = ''.$title_part_one.''.$title_part_two.'
';
}
echo $output;
}
/**
* Hex to RGB(a)
*
* Convert hexdec color string to rgb(a) string.
*
* @since 1.4.4
* @return string
*/
function agama_hex2rgba( $color, $opacity = false ) {
$default = 'rgb(0,0,0)';
// Return default if no color provided
if( empty( $color ) ) {
return $default;
}
// Sanitize $color if "#" is provided
if( $color[0] == '#' ) {
$color = substr( $color, 1 );
}
// Check if color has 6 or 3 characters and get values
if ( strlen( $color ) == 6 ) {
$hex = array( $color[0] . $color[1], $color[2] . $color[3], $color[4] . $color[5] );
} elseif ( strlen( $color ) == 3 ) {
$hex = array( $color[0] . $color[0], $color[1] . $color[1], $color[2] . $color[2] );
} else {
return $default;
}
// Convert hexadec to rgb
$rgb = array_map( 'hexdec', $hex );
// Check if opacity is set(rgba or rgb)
if( $opacity ) {
if( abs( $opacity ) > 1 ) {
$opacity = 1.0;
}
$output = 'rgba('.implode(",",$rgb).','.$opacity.')';
} else {
$output = 'rgb('.implode(",",$rgb).')';
}
return esc_attr( $output );
}
/**
* Get Attachment Image Src
*
* @since 1.0.1
* @return string
*/
function agama_return_image_src( $thumb_size ) {
$att_id = get_post_thumbnail_id();
$att_src = wp_get_attachment_image_src( $att_id, $thumb_size );
return esc_url( $att_src[0] );
}
/**
* Check if $page is template page
*
* @since 1.0.1
* @return string
*/
function agama_is_page_template( $page ) {
if( is_page_template( 'templates/'.$page ) ) {
return true;
}
return false;
}
/**
* Displays navigation to next/previous pages when applicable.
*
* @since 1.0
*/
if ( ! function_exists( 'agama_content_nav' ) ) {
function agama_content_nav( $html_id ) {
global $wp_query;
if ( $wp_query->max_num_pages > 1 ) : ?>
comment_type ) :
case 'pingback' :
case 'trackback' :
// Display trackbacks differently than normal comments.
?>
id="comment-">
', '' ); ?>
id="li-comment-">
',
esc_url( get_permalink() ),
esc_attr( get_the_time() ),
esc_attr( get_the_date('c') ),
esc_html( get_the_date() )
);
$author = sprintf( '%3$s',
esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
esc_attr( sprintf( __( 'View all posts by %s', 'agama' ), get_the_author() ) ),
get_the_author()
);
// Translators: 1 is category, 2 is tag, 3 is the date and 4 is the author's name.
if ( $tag_list ) {
$utility_text = __( 'This entry was posted in %1$s and tagged %2$s on %3$s by %4$s.', 'agama' );
} elseif ( $categories_list ) {
$utility_text = __( 'This entry was posted in %1$s on %3$s by %4$s.', 'agama' );
} else {
$utility_text = __( 'This entry was posted on %3$s by %4$s.', 'agama' );
}
printf(
$utility_text,
$categories_list,
$tag_list,
$date,
$author
);
}
}
/**
* .article-wrapper Grid, List - Style
*
* @since 1.0.1
*/
function agama_article_wrapper_class() {
$blog_layout = esc_attr( get_theme_mod( 'agama_blog_layout', 'list' ) );
switch( $blog_layout ):
case 'list':
echo 'list-style';
break;
case 'grid':
echo 'grid-style';
break;
case 'small_thumbs':
echo 'small_thumbs';
break;
endswitch;
}
/* Omit closing PHP tag to avoid "Headers already sent" issues. */
', '
' ); ?> '', 'depth' => $depth, 'max_depth' => $args['max_depth'] ) ) ); ?>