Ejemplo n.º 1
0
            $day = sprintf('<span class="day">%s</span>', get_the_time(esc_html__('d:', 'clean-my-archives')));
            // Translators: %d is the comment count.
            $comments_num = sprintf(esc_html__('(%d)', 'clean-my-archives'), get_comments_number());
            $comments = sprintf('<span class="comments-number">%s</span>', $comments_num);
            // Check if there's a duplicate day so we can add a class.
            $duplicate_day = $current_day && $daynum === $current_day ? ' class="day-duplicate"' : '';
            $current_day = $daynum;
            // Add the post list item to the formatted archives.
            $clean .= the_title(sprintf('<li%s>%s <a href="%s" rel="bookmark">', $duplicate_day, $day, esc_url(get_permalink())), sprintf('</a> %s</li>', $comments), false);
        }
        // Close the final unordered list.
        $clean .= '</ul>';
    }
    // Wrap the list in a `<div>`.
    if ($clean) {
        $clean = sprintf('<div class="clean-my-archives">%s</div>', $clean);
    }
    // Reset the query to the page's original query.
    wp_reset_postdata();
    // Make sure $cache is an array.
    if (!is_array($cache)) {
        $cache = array();
    }
    // Set the cache for the plugin, so caching plugins can make this super fast.
    $cache[$key] = $clean;
    wp_cache_set('clean_my_archives', $cache);
    // Return the formatted archives.
    return $clean;
}
echo clean_my_archives();
get_footer();
Ejemplo n.º 2
0
	<div id="content" class="hfeed content">

		<?php hybrid_before_content(); // Before content hook ?>

		<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>

			<div id="post-<?php the_ID(); ?>" class="<?php hybrid_entry_class(); ?>">

				<?php hybrid_before_entry(); // Before entry hook ?>

				<div class="entry-content">

					<?php the_content(); ?>

					<?php if ( function_exists( 'clean_my_archives' ) ) : echo clean_my_archives(); ?>

					<?php elseif ( function_exists( 'smartArchives' ) ) : smartArchives( 'both', '' ); ?>

					<?php elseif ( function_exists( 'wp_smart_archives' ) ) : wp_smart_archives(); ?>

					<?php elseif ( function_exists( 'srg_clean_archives' ) ) : srg_clean_archives(); ?>

					<?php else : ?>

						<h2><?php _e( 'Archives by category', 'hybrid' ); ?></h2>

						<ul class="xoxo category-archives">
							<?php wp_list_categories( array( 'feed' => __( 'RSS', 'hybrid' ), 'show_count' => true, 'use_desc_for_title' => false, 'title_li' => false ) ); ?>
						</ul><!-- .xoxo .category-archives -->