/** * A custom function to use to open and display each comment. * * @since 4.0.4 * @param object $_comment Comment to display. * @param array $args An array of arguments. * @param int $depth Depth of comment. */ function cherry_rewrite_comment_item($_comment, $args, $depth) { global $comment; $_comment->cherry_comment_list_args = $args; $comment = $_comment; $tag = 'div' === $args['style'] ? 'div' : 'li'; ?> <<?php echo $tag; ?> <?php comment_class($args['has_children'] ? 'parent' : ''); ?> id="comment-<?php comment_ID(); ?> "> <article id="div-comment-<?php comment_ID(); ?> " class="comment-body"> <?php $comment_item = cherry_parse_tmpl(apply_filters('cherry_comment_item_template_hierarchy', array('content/comment.tmpl'))); echo $comment_item; ?> </article><!-- .comment-body --> <?php }
/** * Maintenance mode * * @since 4.0.0 */ function cherry_maintenance_mode() { $enabled = cherry_get_option('general-maintenance-mode', false); if (isset($_GET['maintenance-preview']) && isset($_GET['nonce']) && wp_verify_nonce($_GET['nonce'], 'cherry-maintenance-preview')) { $preview_mode = true; } else { $preview_mode = false; } if ('true' !== $enabled && !$preview_mode) { return; } if (is_user_logged_in() && current_user_can('manage_options') && !$preview_mode) { return; } $result = cherry_parse_tmpl(apply_filters('cherry_maintenance_mode_template_hierarchy', array('content/maintenance.tmpl'))); echo apply_filters('the_content', $result); wp_footer(); ?> </body> </html> <?php die; }
/** * Loads a post content template based on the post type and/or the post format. * * @author Justin Tadlock <*****@*****.**> * @author Cherry Team <*****@*****.**> * @since 4.0.0 * @return string */ function cherry_get_content_template() { // Set up an empty array and get the post type. $templates = array(); $post_type = get_post_type(); // If the post type supports 'post-formats', get the template based on the format. if (post_type_supports($post_type, 'post-formats')) { // Get the post format. $post_format = get_post_format() ? get_post_format() : 'standard'; // Template based on post type and post format. $templates[] = "content/{$post_type}-{$post_format}.tmpl"; // Template based on the post format. $templates[] = "content/{$post_format}.tmpl"; } // Template based on the post type. $templates[] = "content/{$post_type}.tmpl"; // Fallback 'content.tmpl' template. $templates[] = 'content/content.tmpl'; // Allow devs to filter the content template hierarchy. $templates = apply_filters('cherry_content_template_hierarchy', $templates); printf('%s', cherry_parse_tmpl($templates)); }
/** * Dispaly a `Maintenance mode`. * * @since 4.0.0 */ function cherry_maintenance_mode() { $enabled = cherry_get_option('general-maintenance-mode', false); if (isset($_GET['maintenance-preview']) && isset($_GET['nonce']) && wp_verify_nonce($_GET['nonce'], 'cherry-maintenance-preview')) { $preview_mode = true; } else { $preview_mode = false; } if ('true' !== $enabled && !$preview_mode) { return; } if (is_user_logged_in() && current_user_can('manage_options') && !$preview_mode) { return; } /** * Filter a set of templates for `Maintenance mode`. * * @since 4.0.1 * @param array $templates Set of templates. */ $templates = apply_filters('cherry_maintenance_mode_template_hierarchy', array('content/maintenance.tmpl')); $result = cherry_parse_tmpl($templates); /** This filter is documented in wp-includes/post-template.php */ echo apply_filters('the_content', $result); wp_footer(); ?> </body> </html> <?php die; }