'; } } add_action( 'wp_head', 'cenote_pingback_header' ); /** * Checks if the current page matches the given layout * * @return string $layout layout of current page. */ function cenote_is_layout() { global $post; $layout = ''; if ( is_archive() || is_home() ) { $layout = get_theme_mod( 'cenote_layout_archive', 'layout--no-sidebar' ); } elseif ( is_single() ) { $individual_layout = get_post_meta( $post->ID, 'cenote_post_layout', true ); // If individual layout is set. if ( ! empty( $individual_layout ) ) { $layout = $individual_layout; } else { // if individual layout is not set add global one. $layout = get_theme_mod( 'cenote_layout_single', 'layout--right-sidebar' ); } } elseif ( is_page() ) { $individual_layout = get_post_meta( $post->ID, 'cenote_post_layout', true ); // If individual layout is set. if ( ! empty( $individual_layout ) ) { $layout = $individual_layout; } else { // if individual layout is not set add global one. $layout = get_theme_mod( 'cenote_layout_page', 'layout--right-sidebar' ); } } return $layout; } /** * Retuns the post url * * @return string the link format url. */ function cenote_get_link_url() { $content = get_the_content(); $has_url = get_url_in_content( $content ); return ( $has_url ) ? $has_url : apply_filters( 'the_permalink', get_permalink() ); } /** * Adds the necessary template to load on footer. * * @return void */ function cenote_add_footer_extras() { $menu_style = get_theme_mod( 'cenote_menu_style', 'tg-site-menu--default' ); // Load mobile navigaiton. get_template_part( 'template-parts/menu/menu', 'mobile' ); // Load offcanvas or full screen menu. if ( 'tg-site-menu--offcanvas' === $menu_style || 'tg-site-menu--fullscreen' === $menu_style ) { get_template_part( 'template-parts/menu/menu', 'primary' ); } // load search form. get_template_part( 'template-parts/footer/search', 'form' ); // Show back to top if enabled. if ( true === get_theme_mod( 'cenote_footer_enable_back_to_top', true ) ) { ?>

((<[^>]*>|\s)*)(("|“|‘|‘|“|\')?[A-Z])/U'; $replacement = '$5$7'; $content_filtered = preg_replace( $pattern, $replacement, $content, 1 ); if ( is_single() && true === $single_drop_cap ) { $content = $content_filtered; } // If drop cap is enabled on archive( big block and classic ). if ( ( is_archive() || is_home() ) && true === $archive_drop_cap ) { $content = $content_filtered; } return $content; } add_filter( 'the_content', 'cenote_add_drop_cap_on_content' ); /** * Adds dropcap markup on excerpt * * @param string $excerpt the_excerpt. * @return string $excerpt */ function cenote_add_drop_cap_on_excerpt( $excerpt ) { $archive_style = get_theme_mod( 'cenote_archive_style', 'tg-archive-style--masonry' ); $archive_drop_cap = get_theme_mod( 'cenote_archive_enable_drop_cap', false ); $pattern = '/

([A-Z])/'; $replacement = '

$1'; $excerpt_filtered = preg_replace( $pattern, $replacement, $excerpt, 1 ); if ( ( is_archive() || is_home() ) && true === $archive_drop_cap ) { $excerpt = $excerpt_filtered; } return $excerpt; } add_filter( 'the_excerpt', 'cenote_add_drop_cap_on_excerpt' ); /** * Adds post ribbon. * * @return void */ function cenote_add_post_ribbon() { // Show post ribbon if enabled. if ( is_single() && true === get_theme_mod( 'cenote_single_post_ribbon_display', false ) ) : get_template_part( 'template-parts/post/post', 'ribbon' ); endif; } add_action( 'cenote_after_header', 'cenote_add_post_ribbon', 5 ); /** * Compare user's current version of plugin. */ if ( ! function_exists( 'cenote_plugin_version_compare' ) ) { function cenote_plugin_version_compare( $plugin_slug, $version_to_compare ) { if ( ! function_exists( 'get_plugins' ) ) { require_once ABSPATH . 'wp-admin/includes/plugin.php'; } $installed_plugins = get_plugins(); // Plugin not installed. if ( ! isset( $installed_plugins[ $plugin_slug ] ) ) { return false; } $tdi_user_version = $installed_plugins[ $plugin_slug ]['Version']; return version_compare( $tdi_user_version, $version_to_compare, '<' ); } }