__('Primary', 'author') )); } add_action( 'after_setup_theme', 'ct_author_theme_setup', 10 ); // remove filters adding partial micro-data due to validation issues function ct_author_remove_hybrid_filters() { remove_filter( 'the_author_posts_link', 'hybrid_the_author_posts_link', 5 ); remove_filter( 'get_comment_author_link', 'hybrid_get_comment_author_link', 5 ); remove_filter( 'get_comment_author_url_link', 'hybrid_get_comment_author_url_link', 5 ); remove_filter( 'comment_reply_link', 'hybrid_comment_reply_link_filter', 5 ); remove_filter( 'get_avatar', 'hybrid_get_avatar', 5 ); remove_filter( 'post_thumbnail_html', 'hybrid_post_thumbnail_html', 5 ); remove_filter( 'comments_popup_link_attributes', 'hybrid_comments_popup_link_attributes', 5 ); } add_action('after_setup_theme', 'ct_author_remove_hybrid_filters'); // turn off cleaner gallery if Jetpack gallery functions being used function ct_author_remove_cleaner_gallery() { if( class_exists( 'Jetpack' ) && ( Jetpack::is_module_active( 'carousel' ) || Jetpack::is_module_active( 'tiled-gallery' ) ) ) { remove_theme_support( 'cleaner-gallery' ); } } add_action( 'after_setup_theme', 'ct_author_remove_cleaner_gallery', 11 ); // register widget areas function ct_author_register_widget_areas(){ /* register after post content widget area */ hybrid_register_sidebar( array( 'name' => __( 'Primary Sidebar', 'author' ), 'id' => 'primary', 'description' => __( 'Widgets in this area will be shown in the sidebar', 'author' ) ) ); } add_action('widgets_init','ct_author_register_widget_areas'); /* added to customize the comments. Same as default except -> added use of gravatar images for comment authors */ function ct_author_customize_comments( $comment, $args, $depth ) { $GLOBALS['comment'] = $comment; $comment_type = $comment->comment_type; ?>
  • id="li-comment-">
    comment_author_email === get_option( 'admin_email' ) && get_theme_mod( 'avatar_method' ) == 'upload' ) { echo 'Comment author\'s Gravatar'; } else { echo get_avatar( get_comment_author_email(), 48, '', "Comment author's Gravatar" ); } } ?>
    comment_approved == '0') : ?>

    '; $fields['email'] = '

    '; $fields['url'] = '

    '; return $fields; } } add_filter('comment_form_default_fields','ct_author_update_fields'); if( ! function_exists( 'ct_author_update_comment_field' ) ) { function ct_author_update_comment_field( $comment_field ) { $comment_field = '

    '; return $comment_field; } } add_filter('comment_form_field_comment','ct_author_update_comment_field'); // remove allowed tags text after comment form function ct_author_remove_comments_notes_after($defaults){ $defaults['comment_notes_after']=''; return $defaults; } add_action('comment_form_defaults', 'ct_author_remove_comments_notes_after'); // excerpt handling if( ! function_exists( 'ct_author_excerpt' ) ) { function ct_author_excerpt() { // make post variable available global $post; // make 'read more' setting available global $more; // check for the more tag $ismore = strpos( $post->post_content, '' ); // get the show full post setting $show_full_post = get_theme_mod( 'full_post' ); // if show full post is on, show full post unless on search page if ( ( $show_full_post == 'yes' ) && ! is_search() ) { // set read more value for all posts to 'off' $more = - 1; // output the full content the_content(); } // use the read more link if present elseif ( $ismore ) { the_content( __( 'Continue reading', 'author' ) . "" . get_the_title() . "" ); } // otherwise the excerpt is automatic, so output it else { the_excerpt(); } } } // filter the link on excerpts function ct_author_excerpt_read_more_link($output) { global $post; return $output . "

    " . __('Continue reading', 'author') . "" . get_the_title() . "

    "; } add_filter('the_excerpt', 'ct_author_excerpt_read_more_link'); // change the length of the excerpts function ct_author_custom_excerpt_length( $length ) { $new_excerpt_length = get_theme_mod('excerpt_length'); // if there is a new length set and it's not 15, change it if( ! empty( $new_excerpt_length ) && $new_excerpt_length != 25 ){ return $new_excerpt_length; } else { return 25; } } add_filter( 'excerpt_length', 'ct_author_custom_excerpt_length', 99 ); // switch [...] to ellipsis on automatic excerpt function ct_author_new_excerpt_more( $more ) { return '…'; } add_filter('excerpt_more', 'ct_author_new_excerpt_more'); // turns of the automatic scrolling to the read more link function ct_author_remove_more_link_scroll( $link ) { $link = preg_replace( '|#more-[0-9]+|', '', $link ); return $link; } add_filter( 'the_content_more_link', 'ct_author_remove_more_link_scroll' ); // for displaying featured images function ct_author_featured_image() { // get post object global $post; // default to no featured image $has_image = false; // if post has an image if (has_post_thumbnail( $post->ID ) ) { // get the full-size version of the image $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'single-post-thumbnail' ); // set $image = the url $image = $image[0]; $has_image = true; } if ($has_image == true) { // on posts/pages display the featued image if(is_singular()){ $featured_image = ""; } // on blog/archives display with a link else { $featured_image = " "; } $featured_image = apply_filters( 'ct_author_featured_image', $featured_image ); echo $featured_image; } } // fix for bug with Disqus saying comments are closed if ( function_exists( 'dsq_options' ) ) { remove_filter( 'comments_template', 'dsq_comments_template' ); add_filter( 'comments_template', 'dsq_comments_template', 99 ); // You can use any priority higher than '10' } // associative array of social media sites function ct_author_social_array(){ $social_sites = array( 'twitter' => 'author_twitter_profile', 'facebook' => 'author_facebook_profile', 'google-plus' => 'author_googleplus_profile', 'pinterest' => 'author_pinterest_profile', 'linkedin' => 'author_linkedin_profile', 'youtube' => 'author_youtube_profile', 'vimeo' => 'author_vimeo_profile', 'tumblr' => 'author_tumblr_profile', 'instagram' => 'author_instagram_profile', 'flickr' => 'author_flickr_profile', 'dribbble' => 'author_dribbble_profile', 'rss' => 'author_rss_profile', 'reddit' => 'author_reddit_profile', 'soundcloud' => 'author_soundcloud_profile', 'spotify' => 'author_spotify_profile', 'vine' => 'author_vine_profile', 'yahoo' => 'author_yahoo_profile', 'behance' => 'author_behance_profile', 'codepen' => 'author_codepen_profile', 'delicious' => 'author_delicious_profile', 'stumbleupon' => 'author_stumbleupon_profile', 'deviantart' => 'author_deviantart_profile', 'digg' => 'author_digg_profile', 'git' => 'author_git_profile', 'hacker-news' => 'author_hacker-news_profile', 'steam' => 'author_steam_profile', 'vk' => 'author_vk_profile', 'weibo' => 'author_weibo_profile', 'tencent-weibo' => 'author_tencent_weibo_profile', 'email' => 'author_email_profile' ); return $social_sites; } // used in ct_author_social_icons_output to return urls function ct_author_get_social_url($source, $site){ if( $source == 'header' ) { return get_theme_mod($site); } elseif( $source == 'author' ) { return get_the_author_meta($site); } } // output social icons if( ! function_exists('ct_author_social_icons_output') ) { function ct_author_social_icons_output($source) { // get social sites array $social_sites = ct_author_social_array(); // store the site name and url foreach ( $social_sites as $social_site => $profile ) { if( $source == 'header') { if ( strlen( get_theme_mod( $social_site ) ) > 0 ) { $active_sites[$social_site] = $social_site; } } elseif( $source == 'author' ) { if ( strlen( get_the_author_meta( $profile ) ) > 0 ) { $active_sites[$profile] = $social_site; } } } // for each active social site, add it as a list item if ( ! empty( $active_sites ) ) { echo "
    "; } } } /* * WP will apply the ".menu-primary-items" class & id to the containing
    instead of
      * making styling difficult and confusing. Using this wrapper to add a unique class to make styling easier. */ function ct_author_wp_page_menu() { wp_page_menu(array( "menu_class" => "menu-unset" ) ); } function ct_author_wp_backwards_compatibility() { // not using this function, simply remove it so use of "has_image_size" doesn't break < 3.9 if( get_bloginfo('version') < 3.9 ) { remove_filter( 'image_size_names_choose', 'hybrid_image_size_names_choose' ); } } add_action('init', 'ct_author_wp_backwards_compatibility'); /* * Set the date format for new users. * Needs to be done this way so that the date defaults to the right format, but can * still be changed from the Settings menu */ function ct_author_set_date_format() { // if the date format has never been set by Unlimited, set it if( get_option('ct_author_date_format_origin') != 'updated' ) { update_option('date_format', 'F j, Y'); // add option so never updates date format again. Allows users to change format. add_option('ct_author_date_format_origin', 'updated'); } } add_action( 'init', 'ct_author_set_date_format' ); // used in header.php for primary avatar and comments function ct_author_output_avatar() { // get method for displaying avatar $avatar_method = get_theme_mod('avatar_method'); // if neither gravatar, nor upload used $avatar = ''; // if using gravatar if( $avatar_method == 'gravatar' ){ // get the avatar from the admin email $avatar = get_avatar( get_option('admin_email')); // use regex to grab source from markup $avatar = ct_author_get_avatar_url($avatar); } // if using an upload elseif( $avatar_method == 'upload') { // get the uploaded image $avatar = get_theme_mod('avatar'); } return $avatar; } function ct_author_get_avatar_url($get_avatar){ preg_match("/src='(.*?)'/i", $get_avatar, $matches); return $matches[1]; } function ct_author_nav_dropdown_buttons( $item_output, $item, $depth, $args ) { if ( 'primary' == $args->theme_location) { if( in_array('menu-item-has-children', $item->classes ) || in_array('page_item_has_children', $item->classes ) ) { $item_output = str_replace( $args->link_after . '', $args->link_after . '', $item_output ); } } return $item_output; } add_filter( 'walker_nav_menu_start_el', 'ct_author_nav_dropdown_buttons', 10, 4 ); // custom css output function ct_author_custom_css_output(){ $custom_css = get_theme_mod('custom_css'); /* output custom css */ if( $custom_css ) { wp_add_inline_style( 'ct-author-style', $custom_css ); wp_add_inline_style( 'ct-author-style-rtl', $custom_css ); } } add_action('wp_enqueue_scripts', 'ct_author_custom_css_output', 20); function ct_author_body_class( $classes ) { /* get full post setting */ $full_post = get_theme_mod('full_post'); /* if full post setting on */ if( $full_post == 'yes' ) { $classes[] = 'full-post'; } return $classes; } add_filter( 'body_class', 'ct_author_body_class' ); function ct_author_reset_customizer_options() { // validate name and value if( empty( $_POST['author_reset_customizer'] ) || 'author_reset_customizer_settings' !== $_POST['author_reset_customizer'] ) return; // validate nonce if( ! wp_verify_nonce( $_POST['author_reset_customizer_nonce'], 'author_reset_customizer_nonce' ) ) return; // validate user permissions if( ! current_user_can( 'manage_options' ) ) return; // delete customizer mods remove_theme_mods(); $redirect = admin_url( 'themes.php?page=author-options' ); $redirect = add_query_arg( 'author_status', 'deleted', $redirect); // safely redirect wp_safe_redirect( $redirect ); exit; } add_action( 'admin_init', 'ct_author_reset_customizer_options' ); function ct_author_delete_settings_notice() { if ( isset( $_GET['author_status'] ) ) { ?>

      .

      <?php wp_title(); ?> Featured Post'; } } add_action( 'archive_post_before', 'ct_author_sticky_post_marker' );