post_excerpt ? get_post( get_post_thumbnail_id() )->post_excerpt : get_post( get_post_thumbnail_id() )->post_title; ?>
<?php echo esc_attr( $alt_title ); ?> <?php echo esc_attr( $alt_title ); ?>
<?php echo esc_attr( get_the_title() ); ?>
<?php echo esc_attr( get_the_title() ); ?>
1 ){ echo ' '. esc_html( $category[0]->name ) .''; echo ' '. esc_html( $category[1]->name ) .''; } else{ echo ' '. esc_html( $category[0]->name ) .''; } } /* ================================================================================================================= fasto_cats - Add custom link class to the_category() ================================================================================================================= */ function fasto_categories( $id ){ $categories = get_the_category( $id ); echo '
'; foreach ( $categories as $category ){ $url = get_category_link( $category->term_id ); echo ' '. esc_html( $category->name ) .''; } echo '
'; } /* ================================================================================================================= fasto_count_shares() - Count freebie downloads - for ajax ================================================================================================================= */ add_action( 'wp_ajax_fasto_count_shares', 'fasto_count_shares' ); add_action( 'wp_ajax_nopriv_fasto_count_shares', 'fasto_count_shares' ); function fasto_count_shares() { $nonce = $_POST['nonce']; if ( ! wp_verify_nonce( $nonce, 'fasto_count_shares' ) ){ die ( 'cheatin?'); } $post_id = sanitize_text_field( $_POST['post_id'] ); $share_counter = get_post_meta( $post_id, 'share-counter', true ); if( !$share_counter ) { $share_counter = 0; } $response = update_post_meta( $post_id, 'share-counter', ++$share_counter ); if( $response ){ die('success'); } die('fail'); } /* ================================================================================================================= fasto_output_social - Output social ================================================================================================================= */ function fasto_output_social(){ $socials = array( 'facebook' => 'facebook', 'twitter' => 'twitter', 'youtube' => 'youtube', 'linkedin' => 'linkedin', 'pinterest' => 'pinterest', 'dribbble' => 'dribbble', 'instagram' => 'instagram', 'behance' => 'behance', ); foreach ( $socials as $key => $value ){ $get_social = get_theme_mod( $key ); if ( !empty( $get_social ) ){ echo '
  • '. fasto_brands_svg( esc_html ( $value ) , false ).'
  • '; # fasto_brands_svg() - safely escaped in functions/theme.php } } } /* ================================================================================================================= fasto_author_avatar - Get author avatar ================================================================================================================= */ function fasto_author_avatar(){ $author_id = get_the_author_meta('ID'); $avatar = get_avatar( $author_id ); return get_avatar( $author_id, 80 , '', get_the_author_meta('nickname') ); } /* ================================================================================================================= fasto_author_info - Get author info ================================================================================================================= */ function fasto_author_info( $value ){ $user_id = get_the_author_meta('ID'); $get_user_meta = get_user_meta( $user_id ); return $get_user_meta[$value][0]; } /* ================================================================================================================= fasto_body_class - Add custom body class ================================================================================================================= */ add_filter( 'body_class', 'fasto_body_class' ); function fasto_body_class( $classes ) { //single layout - from theme options or post meta $meta_layout = get_post_meta( get_the_ID(), 'blog-single-layout', true ); $layout = $meta_layout != 'default' ? $meta_layout : get_theme_mod( 'blog-single-layout' ); if ( ( get_theme_mod( 'blog-layout' ) == 'grid-1' || get_theme_mod( 'blog-layout' ) == 'grid-2' ) && ( is_home() || is_category() || is_archive() || is_day() || is_month() || is_year() || is_tag() || is_author() ) ) { $classes[] = 'has-sidebar'; } if ( $layout == 'sidebar' && is_single() ){ $classes[] = 'has-sidebar'; } if ( $layout == 'full' && is_single() ){ $classes[] = 'full'; } return $classes; } /* ================================================================================================================= fasto_enable_threaded_comments() - Threaded Comments ================================================================================================================= */ function fasto_enable_threaded_comments(){ if ( !is_admin() ) { if ( is_singular() && comments_open() && ( get_option( 'thread_comments' ) == 1 ) ) { wp_enqueue_script('comment-reply'); } } } add_action( 'get_header', 'fasto_enable_threaded_comments'); /* ================================================================================================================= fasto_get_the_post_id() - Return the post/page id inside or outside the loop ================================================================================================================= */ function fasto_get_the_post_id() { if ( in_the_loop() ) { $post_id = get_the_ID(); } else { global $wp_query; $post_id = $wp_query->get_queried_object_id(); } return $post_id; } /* ================================================================================================================= fasto_build_cat_itemprop() - Build category breacrumbs ================================================================================================================= */ function fasto_build_cat_itemprop() { $breadcrumbs = array(); $category_count = 0; $parent_arrive = 0; //return early if attachemnt if ( is_attachment() ){ return false; } if (is_single()) { $post_data = get_queried_object(); $breadcrumbs[$category_count]['id'] = $post_data->ID; $breadcrumbs[$category_count]['name'] = $post_data->post_title; $category_count++; $current_category = get_the_category(); $current_category_id = $current_category[0]->term_id; $category = get_category($current_category_id); } else { $category = get_category(get_query_var('cat')); } $breadcrumbs[$category_count]['id'] = $category->term_id; $breadcrumbs[$category_count]['name'] = $category->name; $category_count++; while( $parent_arrive == 0 ) { if ($category->category_parent == 0) { $parent_arrive = 1; } else { $breadcrumbs[$category_count]['id'] = $category->category_parent; $category = get_category($category->category_parent); $breadcrumbs[$category_count]['name'] = $category->name; } $category_count++; } $breadcrumbs = array_reverse($breadcrumbs); return $breadcrumbs; } /* ================================================================================================================= fasto_cat_breadcrumb() - Output category breacrumbs itemprop ================================================================================================================= */ function fasto_cat_breadcrumb(){ //return early if attachemnt if ( is_attachment() ){ return false; } $breadcrumbs = fasto_build_cat_itemprop(); ?> '; echo '
  • '; echo esc_html__( 'Home','fasto' ); echo '
  • ' . "  »  "; if ( is_day() ) { echo '
  • '.esc_html( get_the_time('d') ).' '.esc_html( get_the_time('F') ).' '.esc_html( get_the_time('Y') ).'
  • '; } elseif ( is_month() ) { echo '
  • '.esc_html( get_the_time('F') ).' '.esc_html( get_the_time('Y') ).'
  • '; } elseif ( is_year() ) { echo'
  • '. esc_html( get_the_time('Y') ).'
  • '; } elseif ( is_tag() ){ echo '
  • '.esc_html( single_tag_title( '',false ) ).'
  • '; } elseif ( is_single() ) { } elseif ( is_page() ) { echo '
  • '.esc_html( get_the_title() ).'
  • '; } elseif ( is_search() ) { echo '
  • '.esc_html__( 'Search results for ','fasto' ); echo esc_html( the_search_query() ).'
  • '; } echo ''; } } /* ================================================================================================================= fasto_output_social_share() - Output social share ================================================================================================================= */ function fasto_output_social_share(){ global $post; //post thumbnail $post_thumbnail_arr = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'full-single' ); $post_thumbnail = $post_thumbnail_arr[0]; ?>
    0 ) { ?>
    100, 'width' => 400, 'flex-height' => true, 'flex-width' => true, 'header-text' => array( 'site-title', 'site-description' ), ); add_theme_support( 'custom-logo', $defaults ); } add_action( 'after_setup_theme', 'fasto_custom_logo' ); /* ================================================================================================================= fasto_display_header() - Display theme header ================================================================================================================= */ function fasto_display_header(){ ?>
    '.esc_html__( 'Developed by ','fasto' ).''.esc_html__( 'Fribba.com','fasto' ).'

    '; } add_filter( 'wp_footer', 'fasto_copyright_text' ); /* ================================================================================================================= fasto_copyright() - Hide copyright text if checked ================================================================================================================= */ function fasto_copyright(){ if ( get_theme_mod( 'enable-copyright' ) == '0' ){ $css = '.copyright-fasto{ display:none }'; wp_add_inline_style( 'fasto-custom-css', $css ); } } add_filter( 'wp_enqueue_scripts', 'fasto_copyright' );