'Independent Analytics', 'slug' => 'independent-analytics', 'required' => false, ), ); $config = array( 'id' => 'ct-author', 'default_path' => '', 'menu' => 'tgmpa-install-plugins', 'has_notices' => true, 'dismissable' => true, 'dismiss_msg' => '', 'is_automatic' => false, 'message' => '', 'strings' => array( 'page_title' => __('Install Recommended Plugins', 'author'), 'menu_title' => __('Recommended Plugins', 'author'), 'notice_can_install_recommended' => _n_noop( 'The makers of the Author theme now recommend installing Independent Analytics, their new plugin for visitor tracking: %1$s.', 'The makers of the Author theme now recommend installing Independent Analytics, their new plugin for visitor tracking: %1$s.', 'author' ), ) ); tgmpa($plugins, $config); } add_action('tgmpa_register', 'ct_author_register_required_plugins'); //---------------------------------------------------------------------------------- // Include review request //---------------------------------------------------------------------------------- require_once(trailingslashit(get_template_directory()) . 'dnh/handler.php'); new WP_Review_Me( array( 'days_after' => 14, 'type' => 'theme', 'slug' => 'author', 'message' => __('Hey! Sorry to interrupt, but you\'ve been using Author for a little while now. If you\'re happy with this theme, could you take a minute to leave a review? You won\'t see this notice again after closing it.', 'author') ) ); if (! function_exists(('ct_author_set_content_width'))) { function ct_author_set_content_width() { if (! isset($content_width)) { $content_width = 622; } } } add_action('after_setup_theme', 'ct_author_set_content_width', 0); if (! function_exists('ct_author_theme_setup')) { function ct_author_theme_setup() { add_theme_support('post-thumbnails'); add_theme_support('automatic-feed-links'); add_theme_support('title-tag'); add_theme_support('html5', array( 'search-form', 'comment-form', 'comment-list', 'gallery', 'caption' )); add_theme_support('infinite-scroll', array( 'container' => 'loop-container', 'footer' => 'overflow-container', 'render' => 'ct_author_infinite_scroll_render' )); // Gutenberg - wide & full images add_theme_support('align-wide'); // Gutenberg - add support for editor styles add_theme_support('editor-styles'); // Gutenberg - modify the font sizes add_theme_support('editor-font-sizes', array( array( 'name' => __('small', 'author'), 'shortName' => __('S', 'author'), 'size' => 12, 'slug' => 'small' ), array( 'name' => __('regular', 'author'), 'shortName' => __('M', 'author'), 'size' => 16, 'slug' => 'regular' ), array( 'name' => __('large', 'author'), 'shortName' => __('L', 'author'), 'size' => 21, 'slug' => 'large' ), array( 'name' => __('larger', 'author'), 'shortName' => __('XL', 'author'), 'size' => 37, 'slug' => 'larger' ) )); load_theme_textdomain('author', get_template_directory() . '/languages'); register_nav_menus(array( 'primary' => esc_html__('Primary', 'author') )); // Add WooCommerce support add_theme_support('woocommerce'); // Add support for WooCommerce image gallery features add_theme_support('wc-product-gallery-zoom'); add_theme_support('wc-product-gallery-lightbox'); add_theme_support('wc-product-gallery-slider'); } } add_action('after_setup_theme', 'ct_author_theme_setup', 10); //----------------------------------------------------------------------------- // Load custom stylesheet for the post editor //----------------------------------------------------------------------------- if (! function_exists('ct_author_add_editor_styles')) { function ct_author_add_editor_styles() { add_editor_style('styles/editor-style.css'); } } add_action('admin_init', 'ct_author_add_editor_styles'); if (! function_exists(('ct_author_register_widget_areas'))) { function ct_author_register_widget_areas() { // after post content register_sidebar(array( 'name' => esc_html__('Primary Sidebar', 'author'), 'id' => 'primary', 'description' => esc_html__('Widgets in this area will be shown in the sidebar', 'author'), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

' )); } } add_action('widgets_init', 'ct_author_register_widget_areas'); if (! function_exists('ct_author_customize_comments')) { 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' && get_theme_mod('comment_avatar') == 'yes') { echo '' . get_comment_author() . ''; } else { echo get_avatar(get_comment_author_email(), 48, '', get_comment_author()); } } ?>
    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) { // don't filter the WooCommerce review form if (function_exists('is_woocommerce')) { if (is_woocommerce()) { return $comment_field; } } $comment_field = '

    '; return $comment_field; } } add_filter('comment_form_field_comment', 'ct_author_update_comment_field', 7); if (! function_exists('ct_author_remove_comments_notes_after')) { 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'); if (! function_exists('ct_author_filter_read_more_link')) { function ct_author_filter_read_more_link($custom = false) { if (is_feed()) { return; } global $post; $ismore = strpos($post->post_content, ''); $read_more_text = get_theme_mod('read_more_text'); $new_excerpt_length = get_theme_mod('excerpt_length'); $excerpt_more = ($new_excerpt_length === 0) ? '' : '…'; $output = ''; // add ellipsis for automatic excerpts if (empty($ismore) && $custom !== true) { $output .= $excerpt_more; } // Because i18n text cannot be stored in a variable if (empty($read_more_text)) { $output .= ''; } else { $output .= ''; } return $output; } } add_filter('the_content_more_link', 'ct_author_filter_read_more_link'); // more tags add_filter('excerpt_more', 'ct_author_filter_read_more_link', 10); // automatic excerpts // handle manual excerpts if (! function_exists('ct_author_filter_manual_excerpts')) { function ct_author_filter_manual_excerpts($excerpt) { $excerpt_more = ''; if (has_excerpt()) { $excerpt_more = ct_author_filter_read_more_link(true); } return $excerpt . $excerpt_more; } } add_filter('get_the_excerpt', 'ct_author_filter_manual_excerpts'); if (! function_exists('ct_author_excerpt')) { function ct_author_excerpt() { global $post; $show_full_post = get_theme_mod('full_post'); $ismore = strpos($post->post_content, ''); if ($show_full_post === 'yes' || $ismore) { the_content(); } else { the_excerpt(); } } } if (! function_exists(('ct_author_custom_excerpt_length'))) { function ct_author_custom_excerpt_length($length) { $new_excerpt_length = get_theme_mod('excerpt_length'); if (! empty($new_excerpt_length) && $new_excerpt_length != 25) { return $new_excerpt_length; } elseif ($new_excerpt_length === 0) { return 0; } else { return 25; } } } add_filter('excerpt_length', 'ct_author_custom_excerpt_length', 99); if (! function_exists('ct_author_remove_more_link_scroll')) { 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'); // Yoast OG description has "Continue readingTitle of the Post" due to its use of get_the_excerpt(). This fixes that. function ct_author_update_yoast_og_description($ogdesc) { $read_more_text = get_theme_mod('read_more_text'); if (empty($read_more_text)) { $read_more_text = esc_html__('Continue reading', 'author'); } $ogdesc = substr($ogdesc, 0, strpos($ogdesc, $read_more_text)); return $ogdesc; } add_filter('wpseo_opengraph_desc', 'ct_author_update_yoast_og_description'); if (! function_exists('ct_author_featured_image')) { function ct_author_featured_image() { global $post; $featured_image = ''; if (has_post_thumbnail($post->ID)) { if (is_singular()) { $featured_image = ''; } else { $featured_image = ''; } } $featured_image = apply_filters('ct_author_featured_image', $featured_image); if ($featured_image) { echo $featured_image; } } } if (! function_exists('ct_author_social_array')) { function ct_author_social_array() { $social_sites = array( 'twitter' => 'author_twitter_profile', 'facebook' => 'author_facebook_profile', 'instagram' => 'author_instagram_profile', 'tiktok' => 'author_tiktok_profile', 'linkedin' => 'author_linkedin_profile', 'pinterest' => 'author_pinterest_profile', 'threads' => 'author_threads_profile', 'youtube' => 'author_youtube_profile', 'rss' => 'author_rss_profile', 'email' => 'author_email_profile', 'phone' => 'author_phone_profile', 'email-form' => 'author_email_form_profile', 'amazon' => 'author_amazon_profile', 'artstation' => 'author_artstation_profile', 'bandcamp' => 'author_bandcamp_profile', 'behance' => 'author_behance_profile', 'bitbucket' => 'author_bitbucket_profile', 'codepen' => 'author_codepen_profile', 'delicious' => 'author_delicious_profile', 'deviantart' => 'author_deviantart_profile', 'diaspora' => 'author_diaspora_profile', 'digg' => 'author_digg_profile', 'discord' => 'author_discord_profile', 'dribbble' => 'author_dribbble_profile', 'etsy' => 'author_etsy_profile', 'flickr' => 'author_flickr_profile', 'foursquare' => 'author_foursquare_profile', 'github' => 'author_github_profile', 'goodreads' => 'author_goodreads_profile', 'google-wallet' => 'author_google-wallet_profile', 'hacker-news' => 'author_hacker-news_profile', 'imdb' => 'author_imdb_profile', 'mastodon' => 'author_mastodon_profile', 'medium' => 'author_medium_profile', 'meetup' => 'author_mixcloud_profile', 'mixcloud' => 'author_meetup_profile', 'ok-ru' => 'author_ok_ru_profile', 'orcid' => 'author_orcid_profile', 'patreon' => 'author_patreon_profile', 'paypal' => 'author_paypal_profile', 'pocket' => 'author_pocket_profile', 'podcast' => 'author_podcast_profile', 'qq' => 'author_qq_profile', 'quora' => 'author_quora_profile', 'ravelry' => 'author_ravelry_profile', 'reddit' => 'author_reddit_profile', 'researchgate' => 'author_researchgate_profile', 'signal-messenger' => 'author_signal_messenger_profile', 'skype' => 'author_skype_profile', 'slack' => 'author_slack_profile', 'slideshare' => 'author_slideshare_profile', 'snapchat' => 'author_snapchat_profile', 'soundcloud' => 'author_soundcloud_profile', 'spotify' => 'author_spotify_profile', 'stack-overflow' => 'author_stack_overflow_profile', 'steam' => 'author_steam_profile', 'strava' => 'author_strava_profile', 'stumbleupon' => 'author_stumbleupon_profile', 'telegram' => 'author_telegram_profile', 'tencent-weibo' => 'author_tencent_weibo_profile', 'tumblr' => 'author_tumblr_profile', 'twitch' => 'author_twitch_profile', 'untappd' => 'author_untappd_profile', 'vimeo' => 'author_vimeo_profile', 'vine' => 'author_vine_profile', 'vk' => 'author_vk_profile', 'wechat' => 'author_wechat_profile', 'weibo' => 'author_weibo_profile', 'whatsapp' => 'author_whatsapp_profile', 'xing' => 'author_xing_profile', 'yahoo' => 'author_yahoo_profile', 'yelp' => 'author_yelp_profile', '500px' => 'author_500px_profile', 'social_icon_custom_1' => 'social_icon_custom_1_profile', 'social_icon_custom_2' => 'social_icon_custom_2_profile', 'social_icon_custom_3' => 'social_icon_custom_3_profile' ); return apply_filters('ct_author_social_array_filter', $social_sites); } } if (! function_exists('ct_author_social_icons_output')) { function ct_author_social_icons_output() { $social_sites = ct_author_social_array(); $square_icons = array( 'twitter', 'vimeo', 'youtube', 'pinterest', 'reddit', 'tumblr', 'steam', 'xing', 'github', 'behance', 'facebook' ); foreach ($social_sites as $social_site => $profile) { if (strlen(get_theme_mod($social_site)) > 0) { $active_sites[ $social_site ] = $social_site; } } if (! empty($active_sites)) { echo "
    "; } } } /* * WP will apply the ".menu-primary-items" class & id to the containing
    instead of