'Independent Analytics', 'slug' => 'independent-analytics', 'required' => false, ), ); $config = array( 'id' => 'ct-apex', 'default_path' => '', 'menu' => 'tgmpa-install-plugins', 'has_notices' => true, 'dismissable' => true, 'dismiss_msg' => '', 'is_automatic' => false, 'message' => '', 'strings' => array( 'page_title' => __('Install Recommended Plugins', 'apex'), 'menu_title' => __('Recommended Plugins', 'apex'), 'notice_can_install_recommended' => _n_noop( 'The makers of the Apex theme now recommend installing Independent Analytics, their new plugin for visitor tracking: %1$s.', 'The makers of the Apex theme now recommend installing Independent Analytics, their new plugin for visitor tracking: %1$s.', 'apex' ), ) ); tgmpa($plugins, $config); } add_action('tgmpa_register', 'ct_apex_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' => 'apex', 'message' => __('Hey! Sorry to interrupt, but you\'ve been using Apex 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.', 'apex') ) ); if (! function_exists(('ct_apex_set_content_width'))) { function ct_apex_set_content_width() { if (! isset($content_width)) { $content_width = 882; } } } add_action('after_setup_theme', 'ct_apex_set_content_width', 0); if (! function_exists(('ct_apex_theme_setup'))) { function ct_apex_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_apex_infinite_scroll_render' )); // 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'); // 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', 'apex'), 'shortName' => __('S', 'apex'), 'size' => 12, 'slug' => 'small' ), array( 'name' => __('regular', 'apex'), 'shortName' => __('M', 'apex'), 'size' => 16, 'slug' => 'regular' ), array( 'name' => __('large', 'apex'), 'shortName' => __('L', 'apex'), 'size' => 21, 'slug' => 'large' ), array( 'name' => __('larger', 'apex'), 'shortName' => __('XL', 'apex'), 'size' => 37, 'slug' => 'larger' ) )); register_nav_menus(array( 'primary' => esc_html__('Primary', 'apex') )); load_theme_textdomain('apex', get_template_directory() . '/languages'); } } add_action('after_setup_theme', 'ct_apex_theme_setup', 10); //----------------------------------------------------------------------------- // Load custom stylesheet for the post editor //----------------------------------------------------------------------------- if (! function_exists('ct_apex_add_editor_styles')) { function ct_apex_add_editor_styles() { add_editor_style('styles/editor-style.css'); } } add_action('admin_init', 'ct_apex_add_editor_styles'); if (! function_exists(('ct_apex_register_widget_areas'))) { function ct_apex_register_widget_areas() { // after post content register_sidebar(array( 'name' => esc_html__('Primary Sidebar', 'apex'), 'id' => 'primary', 'description' => esc_html__('Widgets in this area will be shown in the sidebar next to the main post content', 'apex'), 'before_widget' => '', 'before_title' => '
'; $fields['url'] = '
'; return $fields; } } add_filter('comment_form_default_fields', 'ct_apex_update_fields'); if (! function_exists('ct_apex_update_comment_field')) { function ct_apex_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_apex_update_comment_field', 7); if (! function_exists('ct_apex_remove_comments_notes_after')) { function ct_apex_remove_comments_notes_after($defaults) { $defaults['comment_notes_after'] = ''; return $defaults; } } add_action('comment_form_defaults', 'ct_apex_remove_comments_notes_after'); if (! function_exists('ct_apex_filter_read_more_link')) { function ct_apex_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_apex_filter_read_more_link'); // more tags add_filter('excerpt_more', 'ct_apex_filter_read_more_link', 10); // automatic excerpts // handle manual excerpts if (! function_exists('ct_apex_filter_manual_excerpts')) { function ct_apex_filter_manual_excerpts($excerpt) { $excerpt_more = ''; if (has_excerpt()) { $excerpt_more = ct_apex_filter_read_more_link(true); } return $excerpt . $excerpt_more; } } add_filter('get_the_excerpt', 'ct_apex_filter_manual_excerpts'); if (! function_exists('ct_apex_excerpt')) { function ct_apex_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_apex_custom_excerpt_length')) { function ct_apex_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_apex_custom_excerpt_length', 99); if (! function_exists('ct_apex_remove_more_link_scroll')) { function ct_apex_remove_more_link_scroll($link) { $link = preg_replace('|#more-[0-9]+|', '', $link); return $link; } } add_filter('the_content_more_link', 'ct_apex_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_apex_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', 'apex'); } $ogdesc = substr($ogdesc, 0, strpos($ogdesc, $read_more_text)); return $ogdesc; } add_filter('wpseo_opengraph_desc', 'ct_apex_update_yoast_og_description'); if (! function_exists('ct_apex_featured_image')) { function ct_apex_featured_image() { global $post; $featured_image = ''; if (has_post_thumbnail($post->ID)) { if (is_singular()) { $featured_image = '