for posts and comments. add_theme_support( 'automatic-feed-links' ); // This theme supports a variety of post formats. add_theme_support( 'post-formats', array( 'aside', 'image', 'link', 'quote', 'status' ) ); // If sticky header enabled name menu as 'Sticky Header Menu' otherwise 'Top Menu' if( get_theme_mod( 'sticky_header', '1' ) ) { register_nav_menu( 'top', __( 'Sticky Header Menu', 'agama' ) ); }else{ register_nav_menu( 'top', __( 'Top Menu', 'agama' ) ); } // Register primary menu only if sticky header is not enabled. if( ! get_theme_mod( 'sticky_header', '1' ) ) { register_nav_menu( 'primary', __( 'Primary Menu', 'agama' ) ); } /* * This theme supports custom background color and image, * and here we also set up the default background color. */ add_theme_support( 'custom-background', array( 'default-color' => 'e6e6e6', ) ); // This theme uses a custom image size for featured images, displayed on "standard" posts. add_theme_support( 'post-thumbnails' ); set_post_thumbnail_size( 800, 9999 ); // Unlimited height, soft crop // Register custom image sizes add_image_size( 'blog-large', 776, 310, true ); add_image_size( 'blog-medium', 320, 202, true ); add_image_size( 'related-img', 180, 138, true ); add_image_size( 'portfolio-full', 800, 600, true ); add_image_size( 'portfolio-one', 776, 470, true ); add_image_size( 'portfolio-two', 527, 347, true ); add_image_size( 'portfolio-three', 346, 226, true ); add_image_size( 'portfolio-four', 256, 156, true ); add_image_size( 'recent-posts', 700, 441, true ); /* * Declare WooCommerce Support */ add_theme_support( 'woocommerce' ); } add_action( 'after_setup_theme', 'agama_setup' ); /** * Backwards Compatibility for Title Tag * * @since Agama 1.0 */ if ( ! function_exists( '_wp_render_title_tag' ) ) { function agama_slug_render_title() { ?> <?php wp_title( '|', true, 'right' ); ?> 'Open+Sans:400italic,700italic,400,700', 'subset' => $subsets, ); $font_url = esc_url_raw( add_query_arg( $query_args, "//fonts.googleapis.com/css" ) ); } return $font_url; } /** * Primary Class * * @since Agama v1.0.2 */ function agama_primary_class() { global $Agama; if( $Agama->get_meta('_left_sidebar') && $Agama->get_meta('_right_sidebar') ) { echo 'col-md-6'; } else if( $Agama->get_meta('_left_sidebar') && ! $Agama->get_meta('_right_sidebar') || $Agama->get_meta('_right_sidebar') && ! $Agama->get_meta('_left_sidebar') ) { echo 'col-md-9'; } else if( ! $Agama->get_meta('_left_sidebar') && ! $Agama->get_meta('_left_right') ) { echo 'col-md-12'; } } /** * Agama Right Sidebar * * @since Agama v1.0.2 */ function agama_r_sidebar() { global $Agama; if( $Agama->get_meta('_right_sidebar') ) { get_sidebar('1'); } } /** * Agama Left Sidebar * * @since Agama v1.0.2 */ function agama_l_sidebar() { global $Agama; if( $Agama->get_meta('_left_sidebar') ) { get_sidebar('2'); } } /** * Filter TinyMCE CSS path to include Google Fonts. * * Adds additional stylesheets to the TinyMCE editor if needed. * * @uses agama_get_font_url() To get the Google Font stylesheet URL. * @param string $mce_css CSS path to load in TinyMCE. * @return string Filtered CSS path. * @since Agama 1.2 */ function agama_mce_css( $mce_css ) { $font_url = agama_get_font_url(); if ( empty( $font_url ) ) return $mce_css; if ( ! empty( $mce_css ) ) $mce_css .= ','; $mce_css .= esc_url_raw( str_replace( ',', '%2C', $font_url ) ); return $mce_css; } add_filter( 'mce_css', 'agama_mce_css' ); /** * Filter the page title. * * Creates a nicely formatted and more specific title element text * for output in head of document, based on current view. * * @since Agama 1.0 * * @param string $title Default title text for current view. * @param string $sep Optional separator. * @return string Filtered title. */ function agama_wp_title( $title, $sep ) { global $paged, $page; if ( is_feed() ) return $title; // Add the site name. $title .= get_bloginfo( 'name', 'display' ); // Add the site description for the home/front page. $site_description = get_bloginfo( 'description', 'display' ); if ( $site_description && ( is_home() || is_front_page() ) ) $title = "$title $sep $site_description"; // Add a page number if necessary. if ( ( $paged >= 2 || $page >= 2 ) && ! is_404() ) $title = "$title $sep " . sprintf( __( 'Page %s', 'agama' ), max( $paged, $page ) ); return $title; } add_filter( 'wp_title', 'agama_wp_title', 10, 2 ); /** * Agama Thumb Title * Get post-page article title and separates it on two halfs * * @since Agama v1.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; } /** * Get Attachment Image Src * * @since Agama v1.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 $att_src[0]; } /** * Check if current page is template page * * @since Agama v1.0.1 * @return string */ function agama_is_page_template( $page ) { if( is_page_template( 'page-templates/'.$page ) ) { return true; } return false; } /** * Get Portfolio Category Names * * @since Agama v1.0.1 * @return string */ function agama_get_portfolio_categories( $tag ) { global $post; $categories = wp_get_object_terms( $post->ID, 'portfolio-categories' ); if ( ! empty( $categories ) ) { if ( ! is_wp_error( $categories ) ) { echo $tag; foreach( $categories as $term ) { echo '' . esc_html( $term->name ) . ', '; } echo str_replace( '<', 'max_num_pages > 1 ) : ?> comment_type ) : case 'pingback' : case 'trackback' : // Display trackbacks differently than normal comments. ?>
  • id="comment-">

    ', '' ); ?>

  • id="li-comment-">
    %1$s %2$s', get_comment_author_link(), // If current post author is also comment author, make it known visually. ( $comment->user_id === $post->post_author ) ? '' . __( 'Post author', 'agama' ) . '' : '' ); printf( '', esc_url( get_comment_link( $comment->comment_ID ) ), get_comment_time( 'c' ), /* translators: 1: date, 2: time */ sprintf( __( '%1$s at %2$s', 'agama' ), get_comment_date(), get_comment_time() ) ); ?>
    comment_approved ) : ?>

    ', '

    ' ); ?>
    __( 'Reply', 'agama' ), 'after' => ' ', 'depth' => $depth, 'max_depth' => $args['max_depth'] ) ) ); ?>
    ', esc_url( get_permalink() ), esc_attr( get_the_time() ), esc_attr( get_the_date( 'c' ) ), esc_html( get_the_date() ) ); $author = sprintf( '', 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 ); } endif; /** * Extend the default WordPress body classes. * * @since Agama 1.0 * @param array $classes Existing class values. * @return array Filtered class values. */ function agama_body_class( $classes ) { $background_color = get_background_color(); $background_image = get_background_image(); if( get_theme_mod( 'sticky_header', '1' ) ) { $classes[] = 'sticky_header'; } if ( ! is_active_sidebar( 'sidebar-1' ) || is_page_template( 'page-templates/full-width.php' ) ) $classes[] = 'full-width'; if( is_page_template( 'page-templates/portfolio-one-column.php' ) ) { $classes[] = 'portfolio-one-column'; } if( is_page_template( 'page-templates/portfolio-two-columns.php' ) ) { $classes[] = 'portfolio-two-columns'; } if( is_page_template( 'page-templates/portfolio-three-columns.php' ) ) { $classes[] = 'portfolio-three-columns'; } if( is_page_template( 'page-templates/portfolio-four-columns.php' ) ) { $classes[] = 'portfolio-four-columns'; } if ( is_page_template( 'page-templates/front-page.php' ) ) { $classes[] = 'template-front-page'; if ( has_post_thumbnail() ) $classes[] = 'has-post-thumbnail'; if ( is_active_sidebar( 'sidebar-2' ) ) $classes[] = 'two-sidebars'; } 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( 'agama-fonts', 'queue' ) ) $classes[] = 'custom-font-enabled'; if ( ! is_multi_author() ) $classes[] = 'single-author'; return $classes; } add_filter( 'body_class', 'agama_body_class' ); /** * .article-wrapper Grid, List - Style * * @since Agama v1.0.1 */ function aw_class() { if( get_theme_mod('blog_layout', 'list') == 'list' ) { echo 'list-style'; } else if( get_theme_mod('blog_layout', 'list') == 'grid' ) { echo 'grid-style'; } else { echo 'list-style'; } } /** * Agama Social Icons * * @since Agama v1.0.1 */ if( ! function_exists( 'agama_social_icons' ) ) { function agama_social_icons( $tip_position = '' ) { $_target = get_theme_mod('social_url_target', '_self'); // URL target $social = array( 'Facebook' => get_theme_mod('social_facebook', ''), 'Twitter' => get_theme_mod('social_twitter', ''), 'Flickr' => get_theme_mod('social_flickr', ''), 'RSS' => get_theme_mod('social_rss', ''), 'Vimeo' => get_theme_mod('social_vimeo', ''), 'Youtube' => get_theme_mod('social_youtube', ''), 'Instagram' => get_theme_mod('social_instagram', ''), 'Pinterest' => get_theme_mod('social_pinterest', ''), 'Tumblr' => get_theme_mod('social_tumblr', ''), 'Google' => get_theme_mod('social_google', ''), 'Dribbble' => get_theme_mod('social_dribbble', ''), 'Digg' => get_theme_mod('social_digg', ''), 'Linkedin' => get_theme_mod('social_linkedin', ''), 'Blogger' => get_theme_mod('social_blogger', ''), 'Skype' => get_theme_mod('social_skype', ''), 'Forrst' => get_theme_mod('social_forrst', ''), 'Myspace' => get_theme_mod('social_myspace', ''), 'Deviantart'=> get_theme_mod('social_deviantart', ''), 'Yahoo' => get_theme_mod('social_yahoo', ''), 'Reddit' => get_theme_mod('social_reddit', ''), 'PayPal' => get_theme_mod('social_paypal', ''), 'Dropbox' => get_theme_mod('social_dropbox', ''), 'Soundcloud'=> get_theme_mod('social_soundcloud', ''), 'VK' => get_theme_mod('social_vk', ''), 'Email' => get_theme_mod('social_email', '') ); // Output icons foreach( $social as $name => $url ) { if( ! empty( $url ) ) { echo sprintf( '', strtolower($name), $url, $_target, $tip_position, $name ); } } } } /** * Render HTML for blog post date / post format * * @since Agama v1.0.1 */ if( ! function_exists( 'agama_render_blog_post_date' ) ) { function agama_render_blog_post_date() { global $post; // Get post format $format = get_post_format( $post->ID ); switch( $format ): case 'aside': $fa_class = 'fa fa-2x fa-outdent'; break; case 'image': $fa_class = 'fa fa-2x fa-picture-o'; break; case 'link': $fa_class = 'fa fa-2x fa-link'; break; case 'quote': $fa_class = 'fa fa-2x fa-quote-left'; break; case 'status': $fa_class = 'fa fa-2x fa-comment'; break; default: $fa_class = 'fa fa-2x fa-file-text'; endswitch; // If not single post if( !is_single() ) { echo '
    '; echo '
    '; echo sprintf( '%s', get_the_time('d') ); // Get day echo sprintf( '%s', get_the_time('m, Y') ); // Get month, year echo '
    '; echo '
    '; echo sprintf( '', $fa_class ); echo '
    '; echo '
    '; } } } add_action( 'agama_blog_post_date_and_format', 'agama_render_blog_post_date', 10 ); /** * Render HTML blog post meta details * * @since Agama v1.0.1 */ if( ! function_exists( 'agama_render_blog_post_meta' ) ) { function agama_render_blog_post_meta() { _e( 'By', 'agama' ); echo ''; echo ''; echo ' '.get_the_author_link(); echo ''; echo ''; echo '|'; echo sprintf( '%s', get_the_time('F j, Y') ); // Output next details only on list blog layout or on single post page if( get_theme_mod('blog_layout', 'list') == 'list' || is_single() ) { echo '|'; // Get category $categories = get_the_category(); $separator = ','; $output = ''; if( $categories ): foreach($categories as $category) { $output .= 'name ) ) . '">'.$category->cat_name.''.$separator; echo trim( $output, $separator ); } endif; echo '|'; // Comments number if( comments_open() ) { echo sprintf( '%s', get_comments_link(), get_comments_number().__( ' comments', 'agama' ) ); } } } } add_action( 'agama_blog_post_meta', 'agama_render_blog_post_meta', 10 ); /** * Agama Credits * * @since Agama v1.0.1 */ if( ! function_exists( 'agama_render_credits' ) ) { function agama_render_credits() { echo html_entity_decode( get_theme_mod( 'footer_copyright', '2015 © Powered by Theme-Vision.' ) ); } } add_action( 'agama_credits', 'agama_render_credits' );