14, 'type' => 'theme', 'slug' => 'period', 'message' => __('Hey! Sorry to interrupt, but you\'ve been using Period 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.', 'period') ) ); if (! function_exists(('ct_period_set_content_width'))) { function ct_period_set_content_width() { if (! isset($content_width)) { $content_width = 891; } } } add_action('after_setup_theme', 'ct_period_set_content_width', 0); if (! function_exists(('ct_period_theme_setup'))) { function ct_period_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_period_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', 'period'), 'shortName' => __('S', 'period'), 'size' => 12, 'slug' => 'small' ), array( 'name' => __('regular', 'period'), 'shortName' => __('M', 'period'), 'size' => 16, 'slug' => 'regular' ), array( 'name' => __('large', 'period'), 'shortName' => __('L', 'period'), 'size' => 21, 'slug' => 'large' ), array( 'name' => __('larger', 'period'), 'shortName' => __('XL', 'period'), 'size' => 28, 'slug' => 'larger' ) )); register_nav_menus(array( 'primary' => esc_html__('Primary', 'period') )); // 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'); load_theme_textdomain('period', get_template_directory() . '/languages'); } } add_action('after_setup_theme', 'ct_period_theme_setup', 10); //----------------------------------------------------------------------------- // Load custom stylesheet for the post editor //----------------------------------------------------------------------------- if (! function_exists('ct_period_add_editor_styles')) { function ct_period_add_editor_styles() { add_editor_style('styles/editor-style.css'); } } add_action('admin_init', 'ct_period_add_editor_styles'); if (! function_exists(('ct_period_register_widget_areas'))) { function ct_period_register_widget_areas() { register_sidebar(array( 'name' => esc_html__('Primary Sidebar', 'period'), 'id' => 'primary', 'description' => esc_html__('Widgets in this area will be shown in the sidebar next to the main post content', 'period'), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

' )); } } add_action('widgets_init', 'ct_period_register_widget_areas'); if (! function_exists(('ct_period_customize_comments'))) { function ct_period_customize_comments($comment, $args, $depth) { $GLOBALS['comment'] = $comment; global $post; ?>
  • id="li-comment-">
    comment_approved == '0') : ?>

    '; $fields['email'] = '

    '; $fields['url'] = '

    '; return $fields; } } add_filter('comment_form_default_fields', 'ct_period_update_fields'); if (! function_exists('ct_period_update_comment_field')) { function ct_period_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_period_update_comment_field', 7); if (! function_exists('ct_period_remove_comments_notes_after')) { function ct_period_remove_comments_notes_after($defaults) { $defaults['comment_notes_after'] = ''; return $defaults; } } add_action('comment_form_defaults', 'ct_period_remove_comments_notes_after'); if (! function_exists('ct_period_filter_read_more_link')) { function ct_period_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_period_filter_read_more_link'); // more tags add_filter('excerpt_more', 'ct_period_filter_read_more_link', 10); // automatic excerpts // handle manual excerpts if (! function_exists('ct_period_filter_manual_excerpts')) { function ct_period_filter_manual_excerpts($excerpt) { $excerpt_more = ''; if (has_excerpt()) { $excerpt_more = ct_period_filter_read_more_link(true); } return $excerpt . $excerpt_more; } } add_filter('get_the_excerpt', 'ct_period_filter_manual_excerpts'); if (! function_exists('ct_period_excerpt')) { function ct_period_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_period_custom_excerpt_length')) { function ct_period_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_period_custom_excerpt_length', 99); if (! function_exists('ct_period_remove_more_link_scroll')) { function ct_period_remove_more_link_scroll($link) { $link = preg_replace('|#more-[0-9]+|', '', $link); return $link; } } add_filter('the_content_more_link', 'ct_period_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_period_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', 'period'); } $ogdesc = substr($ogdesc, 0, strpos($ogdesc, $read_more_text)); return $ogdesc; } add_filter('wpseo_opengraph_desc', 'ct_period_update_yoast_og_description'); if (! function_exists('ct_period_featured_image')) { function ct_period_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_period_featured_image', $featured_image); if ($featured_image) { echo $featured_image; } } } if (! function_exists('ct_period_social_array')) { function ct_period_social_array() { $social_sites = array( 'twitter' => 'period_twitter_profile', 'facebook' => 'period_facebook_profile', 'instagram' => 'period_instagram_profile', 'tiktok' => 'period_tiktok_profile', 'linkedin' => 'period_linkedin_profile', 'pinterest' => 'period_pinterest_profile', 'youtube' => 'period_youtube_profile', 'rss' => 'period_rss_profile', 'email' => 'period_email_profile', 'phone' => 'period_phone_profile', 'email-form' => 'period_email_form_profile', 'amazon' => 'period_amazon_profile', 'artstation' => 'period_artstation_profile', 'bandcamp' => 'period_bandcamp_profile', 'behance' => 'period_behance_profile', 'bitbucket' => 'period_bitbucket_profile', 'codepen' => 'period_codepen_profile', 'delicious' => 'period_delicious_profile', 'deviantart' => 'period_deviantart_profile', 'diaspora' => 'period_diaspora_profile', 'digg' => 'period_digg_profile', 'discord' => 'period_discord_profile', 'dribbble' => 'period_dribbble_profile', 'etsy' => 'period_etsy_profile', 'flickr' => 'period_flickr_profile', 'foursquare' => 'period_foursquare_profile', 'github' => 'period_github_profile', 'goodreads' => 'period_goodreads_profile', 'google-wallet' => 'period_google_wallet_profile', 'hacker-news' => 'period_hacker-news_profile', 'imdb' => 'period_imdb_profile', 'mastodon' => 'period_mastodon_profile', 'medium' => 'period_medium_profile', 'meetup' => 'period_meetup_profile', 'mixcloud' => 'period_mixcloud_profile', 'ok-ru' => 'period_ok_ru_profile', 'orcid' => 'period_orcid_profile', 'patreon' => 'period_patreon_profile', 'paypal' => 'period_paypal_profile', 'pocket' => 'period_pocket_profile', 'podcast' => 'period_podcast_profile', 'qq' => 'period_qq_profile', 'quora' => 'period_quora_profile', 'ravelry' => 'period_ravelry_profile', 'reddit' => 'period_reddit_profile', 'researchgate' => 'period_researchgate_profile', 'skype' => 'period_skype_profile', 'slack' => 'period_slack_profile', 'slideshare' => 'period_slideshare_profile', 'soundcloud' => 'period_soundcloud_profile', 'spotify' => 'period_spotify_profile', 'snapchat' => 'period_snapchat_profile', 'stack-overflow' => 'period_stack_overflow_profile', 'steam' => 'period_steam_profile', 'strava' => 'period_strava_profile', 'stumbleupon' => 'period_stumbleupon_profile', 'telegram' => 'period_telegram_profile', 'tencent-weibo' => 'period_tencent_weibo_profile', 'tumblr' => 'period_tumblr_profile', 'twitch' => 'period_twitch_profile', 'untappd' => 'period_untappd_profile', 'vimeo' => 'period_vimeo_profile', 'vine' => 'period_vine_profile', 'vk' => 'period_vk_profile', 'wechat' => 'period_wechat_profile', 'weibo' => 'period_weibo_profile', 'whatsapp' => 'period_whatsapp_profile', 'xing' => 'period_xing_profile', 'yahoo' => 'period_yahoo_profile', 'yelp' => 'period_yelp_profile', '500px' => 'period_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_period_social_array_filter', $social_sites); } } //---------------------------------------------------------------------------------- // Output the social media icons //---------------------------------------------------------------------------------- if (! function_exists('ct_period_social_icons_output')) { function ct_period_social_icons_output() { // Get the social icons array $social_sites = ct_period_social_array(); // Store only icons with URLs saved $saved = array(); /* Store the site name and ID if saved /* name: twitter /* id: period_twitter_profile */ foreach ($social_sites as $name => $id) { if (strlen(get_theme_mod($name)) > 0) { $saved[ $name ] = $id; } } // If there are any social profiles saved if (!empty($saved)) { echo "