Skip to content

Instantly share code, notes, and snippets.

View krogsgard's full-sized avatar

Brian Krogsgard krogsgard

View GitHub Profile
@krogsgard
krogsgard / arcticle
Created February 21, 2012 02:06
Twenty Eleven Loop
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
@krogsgard
krogsgard / wordpress-loop
Created February 20, 2012 04:45
The Basic WordPress Loop
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<?php // You can do stuff here to display aspects of the posts which meet the criteria of the current loop. ?>
<?php endwhile; else: ?>
<p><?php _e('The Loop did not find anything.'); ?></p>
<?php endif; ?>
@krogsgard
krogsgard / [entry-modified] shortcode
Created February 12, 2012 19:13
Uses the get_the_modified_time function to created a shortcode, just like the [entry-published] shortcode in Hybrid Core
add_shortcode( 'entry-modified', 'krogs_entry_modified_shortcode' );
function krogs_entry_modified_shortcode( $attr ) {
$domain = hybrid_get_textdomain();
$attr = shortcode_atts( array( 'before' => '', 'after' => '', 'format' => get_option( 'date_format' ) ), $attr );
$modified = '<abbr class="modified" title="' . sprintf( get_the_modified_time( esc_attr__( 'l, F jS, Y, g:i a', $domain ) ) ) . '">' . sprintf( get_the_modified_time( $attr['format'] ) ) . '</abbr>';
return $attr['before'] . $modified . $attr['after'];