/** * Localize scripts and add JavaScript data */ function franz_localize_scripts() { global $franz_settings; $js_object = array('templateUrl' => esc_url(FRANZ_ROOTURI), 'isSingular' => is_singular(), 'shouldShowComments' => franz_should_show_comments(), 'sliderDisable' => $franz_settings['slider_disable'], 'sliderInterval' => $franz_settings['slider_interval'], 'disableResponsiveTables' => $franz_settings['disable_responsive_tables'], 'isTiledPosts' => $franz_settings['tiled_posts']); wp_localize_script('franzjosef', 'franzJS', apply_filters('franz_js_object', $js_object)); }
<?php /** * The template for displaying Comments. * * The area of the page that contains both current comments * and the comment form. The actual display of comments is * handled by a callback to franz_comment which is * located in the functions.php file. * */ global $franz_settings, $is_paginated; if (!franz_should_show_comments()) { return; } if (post_password_required() && (comments_open() || have_comments())) { ?> <div id="comments"> <h3 class="comments-heading"><?php _e('Comments', 'franz-josef'); ?> </h3> <p class="nopassword alert alert-info"><?php _e('This post is password protected. Enter the password to view any comments.', 'franz-josef'); ?> </p> <?php do_action('franz_protected_comment'); ?> </div> <?php
/** * Entry meta */ function franz_entry_meta() { $post_id = get_the_ID(); global $franz_settings; $meta = array(); /* Don't get meta for pages */ if ('page' == get_post_type($post_id)) { return; } /* Print button */ if ($franz_settings['print_button'] && is_singular()) { $meta['print'] = array('class' => 'print-button', 'meta' => '<a href="javascript:print();" title="' . esc_attr__('Print this page', 'franz-josef') . '"><i class="fa fa-print"></i></a>'); } /* Post date */ $meta['date'] = array('class' => 'date', 'meta' => '<a href="' . esc_url(get_permalink($post_id)) . '">' . get_the_time(get_option('date_format')) . '</a>'); /* Post author and categories */ if (!$franz_settings['hide_post_cat']) { $cats = get_the_category(); $categories = array(); if ($cats) { foreach ($cats as $cat) { $categories[] = '<a class="term term-' . esc_attr($cat->taxonomy) . ' term-' . esc_attr($cat->term_id) . '" href="' . esc_url(get_term_link($cat->term_id, $cat->taxonomy)) . '">' . $cat->name . '</a>'; } } if ($categories) { $categories = '<span class="terms">' . implode(', ', $categories) . '</span>'; } } if (!$franz_settings['hide_post_author']) { $author = '<span class="author"><a href="' . esc_url(get_author_posts_url(get_the_author_meta('ID'))) . '" rel="author">' . get_the_author_meta('display_name') . '</a></span>'; } if ($categories && $author) { $byline = sprintf(__('By %1$s under %2$s', 'franz-josef'), $author, $categories); } elseif ($categories) { $byline = sprintf(__('Filed under %2$s', 'franz-josef'), $author, $categories); } elseif ($author) { $byline = sprintf(__('By %s', 'franz-josef'), $author); } else { $byline = false; } if ($byline) { $meta['byline'] = array('class' => 'byline', 'meta' => $byline); } /* Comments link */ if (franz_should_show_comments($post_id)) { $comment_count = get_comment_count($post_id); $comment_text = $comment_count['approved'] ? sprintf(_n('%d comment', '%d comments', $comment_count['approved'], 'franz-josef'), $comment_count['approved']) : __('Leave a reply', 'franz-josef'); $comments_link = $comment_count['approved'] ? get_comments_link() : str_replace('#comments', '#respond', get_comments_link()); $meta['comments'] = array('class' => 'comments-count', 'meta' => '<a href="' . esc_url($comments_link) . '">' . $comment_text . '</a>'); } /* Post tags */ $tags = get_the_tags(); if ($tags) { $html = ''; if (count($tags) > 1) { $html .= '<i class="fa fa-tags"></i>'; } else { $html .= '<i class="fa fa-tag"></i>'; } $tag_links = array(); foreach ($tags as $tag) { $tag_links[] = '<a href="' . esc_url(get_tag_link($tag->term_id)) . '">' . $tag->name . '</a>'; } $html .= implode(', ', $tag_links); if ($html) { $meta['tags'] = array('class' => 'entry-tags', 'meta' => $html); } } $meta = apply_filters('franz_entry_meta', $meta, $post_id); if (!$meta) { return; } ?> <ul class="entry-meta"> <?php foreach ($meta as $item) { ?> <li class="<?php echo esc_attr($item['class']); ?> "><?php echo $item['meta']; ?> </li> <?php } ?> </ul> <?php }