Example #1
0
/**
 * function thesis_comments_link()
 *
 * Generates and outputs a direct link to a page's or post's comments from index
 * or archive views.
 *
 * @since 1.0.2
 */
function thesis_comments_link()
{
    if (!is_single() && !is_page()) {
        $num_comments = get_comments_number();
        $text = comments_open() ? '<a href="' . get_permalink() . '#comments" rel="nofollow">' . thesis_num_comments($num_comments, true) . '</a>' : __('Comments on this entry are closed', 'thesis');
        $text = '<p class="to_comments"><span class="bracket">{</span> ' . $text . ' <span class="bracket">}</span></p>' . "\n";
        echo apply_filters('thesis_comments_link', $text);
    }
}
Example #2
0
/**
 * function thesis_comments_link()
 *
 * Generates and outputs a direct link to a page's or post's comments from index
 * or archive views.
 *
 * @since 1.0.2
 */
function thesis_comments_link()
{
    if (!is_single() && !is_page()) {
        #wp
        $num_comments = get_comments_number();
        #wp
        $link = comments_open() ? '<a href="' . get_permalink() . '#comments" rel="nofollow">' . thesis_num_comments($num_comments, true) . '</a>' : apply_filters('thesis_comments_link_closed', __('Comments on this entry are closed', 'thesis'));
        #wp #filter
        echo "<p class=\"to_comments\">" . apply_filters('thesis_comments_link', $link) . "</p>\n";
        #filter
    }
}
Example #3
0
function thesis_widget_recent_entries($args, $widget_args = 1)
{
    extract($args, EXTR_SKIP);
    if (is_numeric($widget_args)) {
        $widget_args = array('number' => $widget_args);
    }
    $widget_args = wp_parse_args($widget_args, array('number' => -1));
    extract($widget_args, EXTR_SKIP);
    $options = get_option('widget_killer_recent_entries');
    if (!isset($options[$number])) {
        return;
    }
    if ($options[$number]['category'] != 'all') {
        $category = 'category_name=' . $options[$number]['category'];
        if ($options[$number]['title'] == '') {
            $categories =& get_categories('type=post&orderby=name&hide_empty=0');
            if ($categories) {
                foreach ($categories as $current_category) {
                    if ($current_category->slug == $options[$number]['category']) {
                        $title = $current_category->cat_name;
                    }
                }
            }
        } else {
            $title = $options[$number]['title'];
        }
    } elseif ($options[$number]['title'] != '') {
        $category = '';
        $title = $options[$number]['title'];
    } else {
        $category = '';
        $title = __('Recent Posts', 'thesis');
    }
    $numposts = $options[$number]['numposts'];
    $comments = $options[$number]['comments'];
    if (is_home() && $category == '' && $options[$number]['title'] == '') {
        global $posts;
        $title = __('More', 'thesis') . " {$title}";
        $offset = count($posts);
    } else {
        $offset = 0;
    }
    // HTML output
    $custom_query = query_posts("{$category}&showposts={$numposts}&offset={$offset}");
    echo "{$before_widget}\n";
    echo "{$before_title}{$title}{$after_title}\n";
    echo "<ul>\n";
    if (is_array($custom_query)) {
        foreach ($custom_query as $queried_post) {
            if ($comments) {
                if (!comments_open($queried_post->ID)) {
                    $show_comments = get_comments_number($queried_post->ID) > 0 ? ' <a href="' . get_permalink($queried_post->ID) . '#comments"><span class="num_comments" title="' . thesis_num_comments(get_comments_number($queried_post->ID)) . ' ' . __('on this post', 'thesis') . '">' . get_comments_number($queried_post->ID) . '</span></a>' : '';
                } else {
                    $show_comments = ' <a href="' . get_permalink($queried_post->ID) . '#comments"><span class="num_comments" title="' . thesis_num_comments(get_comments_number($queried_post->ID)) . ' ' . __('on this post', 'thesis') . '">' . get_comments_number($queried_post->ID) . '</span></a>';
                }
            } else {
                $show_comments = '';
            }
            echo "\t<li><a href=\"" . get_permalink($queried_post->ID) . '" title="' . __('Click to read', 'thesis') . ' ' . get_the_title($queried_post->ID) . '" rel="bookmark">' . get_the_title($queried_post->ID) . "</a>{$show_comments}</li>\n";
        }
    }
    echo "</ul>\n";
    echo "{$after_widget}\n";
    unset($custom_query);
    wp_reset_query();
}