14,
'type' => 'theme',
'slug' => 'ignite',
'message' => __( 'Hey! Sorry to interrupt, but you\'ve been using Ignite 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.', 'ignite' )
)
);
if ( ! function_exists( ( 'ct_ignite_set_content_width' ) ) ) {
function ct_ignite_set_content_width() {
if ( ! isset( $content_width ) ) {
$content_width = 840;
}
}
}
add_action( 'after_setup_theme', 'ct_ignite_set_content_width', 0 );
if ( ! function_exists( 'ct_ignite_theme_setup' ) ) {
function ct_ignite_theme_setup() {
add_theme_support( 'automatic-feed-links' );
add_theme_support( 'post-thumbnails' );
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'
) );
// Add WooCommerce support
add_theme_support( 'woocommerce' );
// Support 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( 'ignite', get_template_directory() . '/languages' );
}
}
add_action( 'after_setup_theme', 'ct_ignite_theme_setup', 10 );
if ( ! function_exists( 'ct_ignite_register_sidebar' ) ) {
function ct_ignite_register_sidebar() {
register_sidebar( array(
'name' => esc_html__( 'Primary Sidebar', 'ignite' ),
'id' => 'primary',
'description' => esc_html__( 'The main sidebar', 'ignite' ),
'before_widget' => '',
'before_title' => '
'
) );
}
}
add_action( 'widgets_init', 'ct_ignite_register_sidebar' );
if ( ! function_exists( 'ct_ignite_register_menu' ) ) {
function ct_ignite_register_menu() {
register_nav_menu( 'primary', esc_html__( 'Primary', 'ignite' ) );
}
}
add_action( 'init', 'ct_ignite_register_menu' );
if ( ! function_exists( 'ct_ignite_customize_comments' ) ) {
function ct_ignite_customize_comments( $comment, $args, $depth ) {
$GLOBALS['comment'] = $comment;
global $post;
?>
id="li-comment-">
';
$fields['email'] =
'';
$fields['url'] =
'';
return $fields;
}
}
add_filter( 'comment_form_default_fields', 'ct_ignite_update_fields' );
if ( ! function_exists( 'ct_ignite_update_comment_field' ) ) {
function ct_ignite_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_ignite_update_comment_field' );
if ( ! function_exists( 'ct_ignite_remove_comments_notes_after' ) ) {
function ct_ignite_remove_comments_notes_after( $defaults ) {
$defaults['comment_notes_after'] = '';
return $defaults;
}
}
add_action( 'comment_form_defaults', 'ct_ignite_remove_comments_notes_after' );
if ( ! function_exists( 'ct_ignite_filter_read_more_link' ) ) {
function ct_ignite_filter_read_more_link( $custom = false ) {
global $post;
$ismore = strpos( $post->post_content, '' );
$read_more_text = get_theme_mod( 'ct_ignite_read_more_text' );
$new_excerpt_length = get_theme_mod( 'ct_ignite_excerpt_length_settings' );
$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_ignite_filter_read_more_link' ); // more tags
add_filter( 'excerpt_more', 'ct_ignite_filter_read_more_link', 10 ); // automatic excerpts
// handle manual excerpts
if ( ! function_exists( 'ct_ignite_filter_manual_excerpts' ) ) {
function ct_ignite_filter_manual_excerpts( $excerpt ) {
$excerpt_more = '';
if ( has_excerpt() ) {
$excerpt_more = ct_ignite_filter_read_more_link( true );
}
return $excerpt . $excerpt_more;
}
}
add_filter( 'get_the_excerpt', 'ct_ignite_filter_manual_excerpts' );
if ( ! function_exists( 'ct_ignite_excerpt' ) ) {
function ct_ignite_excerpt() {
global $post;
$show_full_post = get_theme_mod( 'ct_ignite_show_full_post_setting' );
$ismore = strpos( $post->post_content, '' );
if ( $show_full_post === 'yes' || $ismore ) {
the_content();
} else {
the_excerpt();
}
}
}
if ( ! function_exists( 'ct_ignite_custom_excerpt_length' ) ) {
function ct_ignite_custom_excerpt_length( $length ) {
$new_excerpt_length = get_theme_mod( 'ct_ignite_excerpt_length_settings' );
if ( ! empty( $new_excerpt_length ) && $new_excerpt_length != 30 ) {
return $new_excerpt_length;
} elseif ( $new_excerpt_length === 0 ) {
return 0;
} else {
return 30;
}
}
}
add_filter( 'excerpt_length', 'ct_ignite_custom_excerpt_length', 999 );
if ( ! function_exists( 'ct_ignite_remove_more_link_scroll' ) ) {
function ct_ignite_remove_more_link_scroll( $link ) {
$link = preg_replace( '|#more-[0-9]+|', '', $link );
return $link;
}
}
add_filter( 'the_content_more_link', 'ct_ignite_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_ignite_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', 'ignite' );
}
$ogdesc = substr( $ogdesc, 0, strpos( $ogdesc, $read_more_text ) );
return $ogdesc;
}
add_filter( 'wpseo_opengraph_desc', 'ct_ignite_update_yoast_og_description' );
if ( ! function_exists( 'ct_ignite_featured_image' ) ) {
function ct_ignite_featured_image() {
global $post;
$featured_image = '';
if ( has_post_thumbnail( $post->ID ) ) {
if ( is_singular() ) {
$featured_image = '' . get_the_post_thumbnail( $post->ID, 'full' ) . '
';
} else {
$featured_image = '';
}
}
if ( $featured_image ) {
echo $featured_image;
}
}
}
if ( ! function_exists( 'ct_ignite_archive_count_add_span' ) ) {
function ct_ignite_archive_count_add_span( $links ) {
$links = str_replace( ' (', '', $links );
$links = str_replace( ')', '', $links );
return $links;
}
}
add_filter( 'get_archives_link', 'ct_ignite_archive_count_add_span' );
if ( ! function_exists( 'ct_ignite_category_count_add_span' ) ) {
function ct_ignite_category_count_add_span( $links ) {
$links = str_replace( ' (', ' ', $links );
$links = str_replace( ')', '', $links );
return $links;
}
}
add_filter( 'wp_list_categories', 'ct_ignite_category_count_add_span' );
if ( ! function_exists( 'ct_ignite_wp_page_menu' ) ) {
function ct_ignite_wp_page_menu() {
wp_page_menu( array( "menu_class" => "menu-unset" ) );
}
}
if ( ! function_exists( 'ct_ignite_body_class' ) ) {
function ct_ignite_body_class( $classes ) {
global $post;
$layout = get_theme_mod( 'ct_ignite_layout_settings' );
if ( $layout == 'left' ) {
$classes[] = 'sidebar-left';
}
if ( get_theme_mod( 'ct_ignite_parent_menu_icon_settings' ) == 'show' ) {
$classes[] = 'parent-icons';
}
// add all historic singular classes
if ( is_singular() ) {
$classes[] = 'singular';
if ( is_singular( 'page' ) ) {
$classes[] = 'singular-page';
$classes[] = 'singular-page-' . $post->ID;
} elseif ( is_singular( 'post' ) ) {
$classes[] = 'singular-post';
$classes[] = 'singular-post-' . $post->ID;
} elseif ( is_singular( 'attachment' ) ) {
$classes[] = 'singular-attachment';
$classes[] = 'singular-attachment-' . $post->ID;
}
}
return $classes;
}
}
add_filter( 'body_class', 'ct_ignite_body_class' );
if ( ! function_exists( 'ct_ignite_post_class_update' ) ) {
function ct_ignite_post_class_update( $classes ) {
if ( ! is_singular() ) {
foreach ( $classes as $key => $class ) {
$classes[] = 'excerpt';
}
} else {
$classes[] = 'entry';
}
return $classes;
}
}
add_filter( 'post_class', 'ct_ignite_post_class_update' );
if ( ! function_exists( 'ct_ignite_logo_positioning_css' ) ) {
function ct_ignite_logo_positioning_css() {
$updown = get_theme_mod( 'logo_positioning_updown_setting' );
$leftright = get_theme_mod( 'logo_positioning_leftright_setting' );
if ( $updown || $leftright ) {
$css = "
#site-header .logo {
position: relative;
bottom: " . $updown . "px;
left: " . $leftright . "px;
right: auto;
top: auto;
}";
$css = ct_ignite_sanitize_css( $css );
wp_add_inline_style( 'ct-ignite-style', $css );
}
}
}
add_action( 'wp_enqueue_scripts', 'ct_ignite_logo_positioning_css', 20 );
if ( ! function_exists( 'ct_ignite_logo_size_css' ) ) {
function ct_ignite_logo_size_css() {
$width = get_theme_mod( 'logo_size_width_setting' );
$height = get_theme_mod( 'logo_size_height_setting' );
if ( $width || $height ) {
$max_width = 156 + $width;
$max_height = 59 + $height;
$css = "
#logo {
max-width: " . $max_width . "px;
max-height: " . $max_height . "px;
}";
$css = ct_ignite_sanitize_css( $css );
wp_add_inline_style( 'ct-ignite-style', $css );
}
}
}
add_action( 'wp_enqueue_scripts', 'ct_ignite_logo_size_css', 20 );
if ( ! function_exists( 'ct_ignite_custom_css_output' ) ) {
function ct_ignite_custom_css_output() {
if ( function_exists( 'wp_get_custom_css' ) ) {
$custom_css = wp_get_custom_css();
} else {
$custom_css = get_theme_mod( 'ct_ignite_custom_css_setting' );
}
if ( $custom_css ) {
$custom_css = ct_ignite_sanitize_css( $custom_css );
wp_add_inline_style( 'ct-ignite-style', $custom_css );
}
}
}
add_action( 'wp_enqueue_scripts', 'ct_ignite_custom_css_output', 20 );
if ( ! function_exists( 'ct_ignite_show_avatars_check' ) ) {
function ct_ignite_show_avatars_check( $classes ) {
$classes[] = get_option( 'show_avatars' ) ? 'avatars' : 'no-avatars';
return $classes;
}
}
add_action( 'comment_class', 'ct_ignite_show_avatars_check' );
if ( ! function_exists( 'ct_ignite_change_font' ) ) {
function ct_ignite_change_font() {
$font = get_theme_mod( 'ct_ignite_font_family_settings' );
$font_weight = get_theme_mod( 'ct_ignite_font_weight_settings' );
$font_style = 'normal';
if ( $font != 'Lusitana' && ! empty( $font ) ) {
if ( $font_weight == 'italic' ) {
$font_weight = 400;
$font_style = 'italic';
} elseif ( strpos( $font_weight, 'italic' ) !== false ) {
$font_weight = str_replace( $font_weight, 'italic', '' );
$font_style = 'italic';
} elseif ( $font_weight == 'regular' ) {
$font_weight = 400;
}
$css = "
body, h1, h2, h3, h4, h5, h6, input:not([type='checkbox']):not([type='radio']):not([type='submit']):not([type='file']), input[type='submit'], textarea {
font-family: $font;
font-style: $font_style;
font-weight: $font_weight;
}
";
$css = ct_ignite_sanitize_css( $css );
wp_add_inline_style( 'ct-ignite-style', $css );
wp_deregister_style( 'ct-ignite-google-fonts' );
$fonts_url = ct_ignite_format_font_request( $font );
wp_register_style( 'ct-ignite-google-fonts', $fonts_url );
wp_enqueue_style( 'ct-ignite-google-fonts' );
}
}
}
add_action( 'wp_enqueue_scripts', 'ct_ignite_change_font', 20 );
if ( ! function_exists( 'ct_ignite_format_font_request' ) ) {
function ct_ignite_format_font_request( $font ) {
$ajax = false;
$weights = ct_ignite_get_available_font_weights( $font );
$fonts_url = '';
if ( isset( $_POST['font'] ) ) {
$font = $_POST['font'];
$ajax = true;
}
if ( is_array( $weights ) && ! empty( $weights ) ) {
$weights = implode( ',', $weights );
$weights = str_replace( 'regular', '400', $weights );
$font = str_replace( ' ', '+', $font );
$font_request = $font . ':' . $weights;
$font_args = array(
'family' => $font_request,
'subset' => urlencode( 'latin,latin-ext' )
);
$fonts_url = add_query_arg( $font_args, '//fonts.googleapis.com/css' );
$fonts_url = apply_filters( 'ignite-font-filter', $fonts_url );
$fonts_url = esc_url_raw( $fonts_url );
}
if ( $ajax ) {
echo $fonts_url;
die();
} else {
return $fonts_url;
}
}
}
add_action( 'wp_ajax_format_font_request', 'ct_ignite_format_font_request' );
add_action( 'wp_ajax_nopriv_format_font_request', 'ct_ignite_format_font_request' );
if ( ! function_exists( 'ct_ignite_background_css' ) ) {
function ct_ignite_background_css() {
$background_color = get_theme_mod( 'ct_ignite_background_color_setting' );
if ( $background_color != '#eeede8' ) {
$background_color_css = "
.overflow-container {
background: $background_color;
}
.main, .sidebar-primary-container, .breadcrumb-trail {
background: none;
}
";
$background_color_css = ct_ignite_sanitize_css( $background_color_css );
wp_add_inline_style( 'ct-ignite-style', $background_color_css );
}
}
}
add_action( 'wp_enqueue_scripts', 'ct_ignite_background_css', 20 );
if ( ! function_exists( 'ct_ignite_customizer_social_media_array' ) ) {
function ct_ignite_customizer_social_media_array() {
$social_sites = array(
'twitter',
'facebook',
'instagram',
'linkedin',
'pinterest',
'youtube',
'rss',
'email',
'phone',
'email-form',
'academia',
'amazon',
'bandcamp',
'behance',
'bitbucket',
'codepen',
'delicious',
'deviantart',
'digg',
'discord',
'dribbble',
'etsy',
'flickr',
'foursquare',
'github',
'google-plus',
'google-wallet',
'hacker-news',
'medium',
'meetup',
'mixcloud',
'ok-ru',
'patreon',
'paypal',
'podcast',
'qq',
'quora',
'ravelry',
'reddit',
'skype',
'slack',
'slideshare',
'snapchat',
'soundcloud',
'spotify',
'stack-overflow',
'steam',
'stumbleupon',
'telegram',
'tencent-weibo',
'tumblr',
'twitch',
'vimeo',
'vine',
'vk',
'wechat',
'weibo',
'whatsapp',
'xing',
'yahoo',
'yelp',
'500px'
);
return apply_filters( 'ct_ignite_customizer_social_media_array_filter', $social_sites );
}
}
if ( ! function_exists( 'ct_ignite_add_meta_elements' ) ) {
function ct_ignite_add_meta_elements() {
$meta_elements = '';
$meta_elements .= sprintf( '' . "\n", esc_attr( get_bloginfo( 'charset' ) ) );
$meta_elements .= '' . "\n";
$theme = wp_get_theme( get_template() );
$template = sprintf( '' . "\n", esc_attr( $theme->get( 'Name' ) ), esc_attr( $theme->get( 'Version' ) ) );
$meta_elements .= $template;
echo $meta_elements;
}
}
add_action( 'wp_head', 'ct_ignite_add_meta_elements', 1 );
/* Move the WordPress generator to a better priority. */
remove_action( 'wp_head', 'wp_generator' );
add_action( 'wp_head', 'wp_generator', 1 );
if ( ! function_exists( 'ct_ignite_get_content_template' ) ) {
function ct_ignite_get_content_template() {
// Blog
if ( is_home() ) {
get_template_part( 'content', get_post_type() );
} // Post/Page
elseif ( is_singular() ) {
get_template_part( 'content', get_post_type() );
comments_template();
} // Archive
elseif ( is_archive() ) {
if ( function_exists( 'is_bbpress' ) ) {
// bbPress forum list
if ( is_bbpress() ) {
get_template_part( 'content/bbpress' );
} // normal archive
else {
get_template_part( 'content' );
}
} // Archive
else {
get_template_part( 'content' );
}
} // bbPress
elseif ( function_exists( 'is_bbpress' ) && is_bbpress() ) {
get_template_part( 'content/bbpress' );
} // Custom Post Type
else {
get_template_part( 'content', get_post_type() );
}
}
}
// allow skype URIs to be used
if ( ! function_exists( 'ct_ignite_allow_skype_protocol' ) ) {
function ct_ignite_allow_skype_protocol( $protocols ) {
$protocols[] = 'skype';
return $protocols;
}
}
add_filter( 'kses_allowed_protocols' , 'ct_ignite_allow_skype_protocol' );
// trigger theme switch on link click and send to Appearance menu
function ct_ignite_welcome_redirect() {
$welcome_url = add_query_arg(
array(
'page' => 'ignite-options',
'ignite_status' => 'activated'
),
admin_url( 'themes.php' )
);
wp_safe_redirect( esc_url_raw( $welcome_url ) );
}
add_action( 'after_switch_theme', 'ct_ignite_welcome_redirect' );
if ( ! function_exists( ( 'ct_ignite_settings_notice' ) ) ) {
function ct_ignite_settings_notice() {
if ( isset( $_GET['ignite_status'] ) ) {
if ( $_GET['ignite_status'] == 'deleted' ) {
?>
'. __('Scroll to the top', 'ignite') .'';
}
}
add_action( 'ct_ignite_body_bottom', 'ct_ignite_scroll_to_top_arrow');
if ( ! function_exists( 'ct_ignite_reset_customizer_options' ) ) {
function ct_ignite_reset_customizer_options() {
if ( empty( $_POST['ignite_reset_customizer'] ) || 'ignite_reset_customizer_settings' !== $_POST['ignite_reset_customizer'] ) {
return;
}
if ( ! wp_verify_nonce( $_POST['ignite_reset_customizer_nonce'], 'ignite_reset_customizer_nonce' ) ) {
return;
}
if ( ! current_user_can( 'edit_theme_options' ) ) {
return;
}
$mods_array = array(
'logo_upload',
'logo_positioning_updown_setting',
'logo_positioning_leftright_setting',
'logo_size_width_setting',
'logo_size_height_setting',
'ct_ignite_layout_settings',
'ct_ignite_font_family_settings',
'ct_ignite_font_weight_settings',
'ct_ignite_background_color_setting',
'ct_ignite_post_meta_date_settings',
'ct_ignite_post_meta_author_settings',
'ct_ignite_post_meta_categories_settings',
'ct_ignite_post_meta_tags_settings',
'ct_ignite_post_meta_comments_settings',
'ct_ignite_post_meta_further_reading_settings',
'ct_ignite_comments_setting',
'ct_ignite_footer_text_setting',
'ct_ignite_custom_css_setting',
'scroll_to_top',
'ct_ignite_show_full_post_setting',
'ct_ignite_show_breadcrumbs_setting',
'ct_ignite_author_meta_settings',
'ct_ignite_parent_menu_icon_settings',
'ct_ignite_excerpt_length_settings',
'ct_ignite_read_more_text'
);
$social_sites = ct_ignite_customizer_social_media_array();
// add social site settings to mods array
foreach ( $social_sites as $social_site ) {
$mods_array[] = $social_site;
}
$mods_array = apply_filters( 'ct_ignite_mods_to_remove', $mods_array );
foreach ( $mods_array as $theme_mod ) {
remove_theme_mod( $theme_mod );
}
$redirect = admin_url( 'themes.php?page=ignite-options' );
$redirect = add_query_arg( 'ignite_status', 'deleted', $redirect );
// safely redirect
wp_safe_redirect( $redirect );
exit;
}
}
add_action( 'admin_init', 'ct_ignite_reset_customizer_options' );