'Independent Analytics',
'slug' => 'independent-analytics',
'required' => false,
),
);
$config = array(
'id' => 'ct-cele',
'default_path' => '',
'menu' => 'tgmpa-install-plugins',
'has_notices' => true,
'dismissable' => true,
'dismiss_msg' => '',
'is_automatic' => false,
'message' => '',
'strings' => array(
'page_title' => __('Install Recommended Plugins', 'cele'),
'menu_title' => __('Recommended Plugins', 'cele'),
'notice_can_install_recommended' => _n_noop(
'The makers of the Cele theme now recommend installing Independent Analytics, their new plugin for visitor tracking: %1$s.',
'The makers of the Cele theme now recommend installing Independent Analytics, their new plugin for visitor tracking: %1$s.',
'cele'
),
)
);
tgmpa($plugins, $config);
}
add_action('tgmpa_register', 'ct_cele_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' => 'cele',
'message' => __('Hey! Sorry to interrupt, but you\'ve been using Cele 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.', 'cele')
)
);
if (! function_exists(('ct_cele_set_content_width'))) {
function ct_cele_set_content_width()
{
if (! isset($content_width)) {
$content_width = 891;
}
}
}
add_action('after_setup_theme', 'ct_cele_set_content_width', 0);
if (! function_exists(('ct_cele_theme_setup'))) {
function ct_cele_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_cele_infinite_scroll_render'
));
register_nav_menus(array(
'primary' => esc_html__('Primary', 'cele')
));
// 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 - 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', 'cele'),
'shortName' => __('S', 'cele'),
'size' => 12,
'slug' => 'small'
),
array(
'name' => __('regular', 'cele'),
'shortName' => __('M', 'cele'),
'size' => 16,
'slug' => 'regular'
),
array(
'name' => __('large', 'cele'),
'shortName' => __('L', 'cele'),
'size' => 21,
'slug' => 'large'
),
array(
'name' => __('larger', 'cele'),
'shortName' => __('XL', 'cele'),
'size' => 28,
'slug' => 'larger'
)
));
load_theme_textdomain('cele', get_template_directory() . '/languages');
}
}
add_action('after_setup_theme', 'ct_cele_theme_setup', 10);
//-----------------------------------------------------------------------------
// Load custom stylesheet for the post editor
//-----------------------------------------------------------------------------
if (! function_exists('ct_cele_add_editor_styles')) {
function ct_cele_add_editor_styles()
{
add_editor_style('styles/editor-style.css');
}
}
add_action('admin_init', 'ct_cele_add_editor_styles');
if (! function_exists(('ct_cele_register_widget_areas'))) {
function ct_cele_register_widget_areas()
{
register_sidebar(array(
'name' => esc_html__('Primary Sidebar', 'cele'),
'id' => 'primary',
'description' => esc_html__('Widgets in this area will be shown in the sidebar next to the main post content', 'cele'),
'before_widget' => '',
'before_title' => '
'
));
}
}
add_action('widgets_init', 'ct_cele_register_widget_areas');
if (! function_exists(('ct_cele_customize_comments'))) {
function ct_cele_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_cele_update_fields');
if (! function_exists('ct_cele_update_comment_field')) {
function ct_cele_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_cele_update_comment_field', 7);
if (! function_exists('ct_cele_remove_comments_notes_after')) {
function ct_cele_remove_comments_notes_after($defaults)
{
$defaults['comment_notes_after'] = '';
return $defaults;
}
}
add_action('comment_form_defaults', 'ct_cele_remove_comments_notes_after');
if (! function_exists('ct_cele_filter_read_more_link')) {
function ct_cele_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_cele_filter_read_more_link'); // more tags
add_filter('excerpt_more', 'ct_cele_filter_read_more_link', 10); // automatic excerpts
// handle manual excerpts
if (! function_exists('ct_cele_filter_manual_excerpts')) {
function ct_cele_filter_manual_excerpts($excerpt)
{
$excerpt_more = '';
if (has_excerpt()) {
$excerpt_more = ct_cele_filter_read_more_link(true);
}
return $excerpt . $excerpt_more;
}
}
add_filter('get_the_excerpt', 'ct_cele_filter_manual_excerpts');
if (! function_exists('ct_cele_excerpt')) {
function ct_cele_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_cele_custom_excerpt_length')) {
function ct_cele_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_cele_custom_excerpt_length', 99);
if (! function_exists('ct_cele_remove_more_link_scroll')) {
function ct_cele_remove_more_link_scroll($link)
{
$link = preg_replace('|#more-[0-9]+|', '', $link);
return $link;
}
}
add_filter('the_content_more_link', 'ct_cele_remove_more_link_scroll');
// Yoast OG description has "Continue readingPost Title Here" due to its use of get_the_excerpt(). This fixes that.
function ct_cele_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', 'cele');
}
$ogdesc = substr($ogdesc, 0, strpos($ogdesc, $read_more_text));
return $ogdesc;
}
add_filter('wpseo_opengraph_desc', 'ct_cele_update_yoast_og_description');
if (! function_exists('ct_cele_featured_image')) {
function ct_cele_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 = '';
}
}
$featured_image = apply_filters('ct_cele_featured_image', $featured_image);
if ($featured_image) {
echo $featured_image;
}
}
}
if (! function_exists('ct_cele_social_array')) {
function ct_cele_social_array()
{
$social_sites = array(
'twitter' => 'cele_twitter_profile',
'facebook' => 'cele_facebook_profile',
'instagram' => 'cele_instagram_profile',
'linkedin' => 'cele_linkedin_profile',
'pinterest' => 'cele_pinterest_profile',
'youtube' => 'cele_youtube_profile',
'rss' => 'cele_rss_profile',
'email' => 'cele_email_profile',
'phone' => 'cele_phone_profile',
'email-form' => 'cele_email_form_profile',
'amazon' => 'cele_amazon_profile',
'artstation' => 'cele_artstation_profile',
'bandcamp' => 'cele_bandcamp_profile',
'behance' => 'cele_behance_profile',
'bitbucket' => 'cele_bitbucket_profile',
'codepen' => 'cele_codepen_profile',
'delicious' => 'cele_delicious_profile',
'deviantart' => 'cele_deviantart_profile',
'digg' => 'cele_digg_profile',
'discord' => 'cele_discord_profile',
'dribbble' => 'cele_dribbble_profile',
'etsy' => 'cele_etsy_profile',
'flickr' => 'cele_flickr_profile',
'foursquare' => 'cele_foursquare_profile',
'github' => 'cele_github_profile',
'goodreads' => 'cele_goodreads_profile',
'google-wallet' => 'cele_google_wallet_profile',
'hacker-news' => 'cele_hacker-news_profile',
'medium' => 'cele_medium_profile',
'meetup' => 'cele_meetup_profile',
'mixcloud' => 'cele_mixcloud_profile',
'ok-ru' => 'cele_ok_ru_profile',
'orcid' => 'cele_orcid_profile',
'patreon' => 'cele_patreon_profile',
'paypal' => 'cele_paypal_profile',
'pocket' => 'cele_pocket_profile',
'podcast' => 'cele_podcast_profile',
'qq' => 'cele_qq_profile',
'quora' => 'cele_quora_profile',
'ravelry' => 'cele_ravelry_profile',
'reddit' => 'cele_reddit_profile',
'researchgate' => 'cele_researchgate_profile',
'skype' => 'cele_skype_profile',
'slack' => 'cele_slack_profile',
'slideshare' => 'cele_slideshare_profile',
'soundcloud' => 'cele_soundcloud_profile',
'spotify' => 'cele_spotify_profile',
'snapchat' => 'cele_snapchat_profile',
'stack-overflow' => 'cele_stack_overflow_profile',
'steam' => 'cele_steam_profile',
'strava' => 'cele_strava_profile',
'stumbleupon' => 'cele_stumbleupon_profile',
'telegram' => 'cele_telegram_profile',
'tencent-weibo' => 'cele_tencent_weibo_profile',
'tumblr' => 'cele_tumblr_profile',
'twitch' => 'cele_twitch_profile',
'untappd' => 'cele_untappd_profile',
'vimeo' => 'cele_vimeo_profile',
'vine' => 'cele_vine_profile',
'vk' => 'cele_vk_profile',
'wechat' => 'cele_wechat_profile',
'weibo' => 'cele_weibo_profile',
'whatsapp' => 'cele_whatsapp_profile',
'xing' => 'cele_xing_profile',
'yahoo' => 'cele_yahoo_profile',
'yelp' => 'cele_yelp_profile',
'500px' => 'cele_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_cele_social_array_filter', $social_sites);
}
}
if (! function_exists('ct_cele_social_icons_output')) {
function ct_cele_social_icons_output()
{
$social_sites = ct_cele_social_array();
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
* making styling difficult and confusing. Using this wrapper to add a unique class to make styling easier.
*/
if (! function_exists(('ct_cele_wp_page_menu'))) {
function ct_cele_wp_page_menu()
{
wp_page_menu(
array(
"menu_class" => "menu-unset",
"depth" => - 1
)
);
}
}
if (! function_exists(('ct_cele_nav_dropdown_buttons'))) {
function ct_cele_nav_dropdown_buttons($item_output, $item, $depth, $args)
{
if ($args->theme_location == 'primary') {
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_cele_nav_dropdown_buttons', 10, 4);
if (! function_exists(('ct_cele_sticky_post_marker'))) {
function ct_cele_sticky_post_marker()
{
if (is_sticky() && !is_archive() && !is_search()) {
echo '' . esc_html__("Featured", "cele") . '
';
}
}
}
add_action('ct_cele_sticky_post_status', 'ct_cele_sticky_post_marker');
if (! function_exists(('ct_cele_reset_customizer_options'))) {
function ct_cele_reset_customizer_options()
{
if (empty($_POST['cele_reset_customizer']) || 'cele_reset_customizer_settings' !== $_POST['cele_reset_customizer']) {
return;
}
if (! wp_verify_nonce($_POST['cele_reset_customizer_nonce'], 'cele_reset_customizer_nonce')) {
return;
}
if (! current_user_can('edit_theme_options')) {
return;
}
$mods_array = array(
'logo_upload',
'full_post',
'excerpt_length',
'read_more_text',
'display_post_author',
'display_post_date',
'custom_css'
);
$social_sites = ct_cele_social_array();
// add social site settings to mods array
foreach ($social_sites as $social_site => $value) {
$mods_array[] = $social_site;
}
$mods_array = apply_filters('ct_cele_mods_to_remove', $mods_array);
foreach ($mods_array as $theme_mod) {
remove_theme_mod($theme_mod);
}
$redirect = admin_url('themes.php?page=cele-options');
$redirect = add_query_arg('cele_status', 'deleted', $redirect);
// safely redirect
wp_safe_redirect($redirect);
exit;
}
}
add_action('admin_init', 'ct_cele_reset_customizer_options');
if (! function_exists(('ct_cele_delete_settings_notice'))) {
function ct_cele_delete_settings_notice()
{
if (isset($_GET['cele_status'])) {
if ($_GET['cele_status'] == 'deleted') {
?>
';
}
return $svg;
}
}
if (! function_exists(('ct_cele_add_meta_elements'))) {
function ct_cele_add_meta_elements()
{
$meta_elements = '';
$meta_elements .= sprintf('' . "\n", esc_html(get_bloginfo('charset')));
$meta_elements .= '' . "\n";
echo $meta_elements;
}
}
add_action('wp_head', 'ct_cele_add_meta_elements', 1);
if (! function_exists(('ct_cele_infinite_scroll_render'))) {
function ct_cele_infinite_scroll_render()
{
while (have_posts()) {
the_post();
get_template_part('content', 'archive');
}
}
}
if (! function_exists('ct_cele_get_content_template')) {
function ct_cele_get_content_template()
{
if (function_exists('is_bbpress')) {
if (is_bbpress()) {
get_template_part('content/bbpress');
return;
}
}
if (is_home() || is_archive()) {
get_template_part('content-archive', get_post_type());
} else {
get_template_part('content', get_post_type());
}
}
}
// allow skype URIs to be used
if (! function_exists('ct_cele_allow_skype_protocol')) {
function ct_cele_allow_skype_protocol($protocols)
{
$protocols[] = 'skype';
return $protocols;
}
}
add_filter('kses_allowed_protocols', 'ct_cele_allow_skype_protocol');
//----------------------------------------------------------------------------------
// Add paragraph tags for author bio displayed in content/archive-header.php.
// the_archive_description includes paragraph tags for tag and category descriptions, but not the author bio.
//----------------------------------------------------------------------------------
if (! function_exists('ct_cele_modify_archive_descriptions')) {
function ct_cele_modify_archive_descriptions($description)
{
if (is_author()) {
$description = wpautop($description);
}
return $description;
}
}
add_filter('get_the_archive_description', 'ct_cele_modify_archive_descriptions');
//----------------------------------------------------------------------------------
// Output the markup for the optional scroll-to-top arrow
//----------------------------------------------------------------------------------
function ct_cele_scroll_to_top_arrow()
{
$setting = get_theme_mod('scroll_to_top');
if ($setting == 'yes') {
echo '';
}
}
add_action('ct_cele_body_bottom', 'ct_cele_scroll_to_top_arrow');
//----------------------------------------------------------------------------------
// Output the "Last Updated" date on posts
//----------------------------------------------------------------------------------
function ct_cele_output_last_updated_date()
{
global $post;
if (get_the_modified_date() != get_the_date()) {
$updated_post = get_post_meta($post->ID, 'ct_cele_last_updated', true);
$updated_customizer = get_theme_mod('last_updated');
if (
($updated_customizer == 'yes' && ($updated_post != 'no'))
|| $updated_post == 'yes'
) {
echo ''. esc_html__("Last updated on", "cele") . ' ' . get_the_modified_date() . '
';
}
}
}
//----------------------------------------------------------------------------------
// Output standar pagination and account for bbPress forum archives
//----------------------------------------------------------------------------------
function ct_cele_pagination()
{
if (function_exists('is_bbpress')) {
if (is_bbpress()) {
return;
}
}
the_posts_pagination(array(
'prev_text' => esc_html__('Previous', 'cele'),
'next_text' => esc_html__('Next', 'cele')
));
}
//----------------------------------------------------------------------------------
// Add support for Elementor headers & footers
//----------------------------------------------------------------------------------
function ct_cele_register_elementor_locations($elementor_theme_manager)
{
$elementor_theme_manager->register_location('header');
$elementor_theme_manager->register_location('footer');
}
add_action('elementor/theme/register_locations', 'ct_cele_register_elementor_locations');