Skip to content

Instantly share code, notes, and snippets.

View jtsternberg's full-sized avatar
😎
Awesome Motive-ing

Justin Sternberg jtsternberg

😎
Awesome Motive-ing
View GitHub Profile
@jtsternberg
jtsternberg / home.php
Created February 13, 2012 21:45 — forked from gregrickaby/home.php
Genesis Custom Loop w/ Featured Image
<?php
$odd_or_even = 'even';
$loop_2 = new WP_Query( 'cat=1&showposts=2&orderby=date&order=DESC' ); while ($loop_2->have_posts()) : $loop_2->the_post(); ?>
<div <?php post_class( $odd_or_even ); ?>>
<?php $odd_or_even = ( 'odd' == $odd_or_even ) ? 'even' : 'odd'; ?>
<div class="column-5 left">
<a href="<?php the_permalink(); ?>" /><?php the_post_thumbnail( 'thumbnail', array( 'class' => 'featured-image' ) ); ?></a>
<a href="<?php the_permalink(); ?>" /><span class="read-more">Read More</span></a>
@jtsternberg
jtsternberg / nothing.php
Created February 15, 2012 16:13 — forked from wpsmith/nothing.php
Trying to add "last-post" class to the loop
$post_classes = get_post_class();
$odd_or_even = 'even';
$post_counter = 0;
$post_counter++;
$odd_or_even = ( 'odd' == $odd_or_even ) ? 'even' : 'odd';
$post_classes[] = ( $post_counter == count( $posts ) ) ? 'last-post' :$odd_or_even;
echo '<div class="' . implode( ' ', $post_classes ) . '">';
@jtsternberg
jtsternberg / radio-latest-news-widget.php
Created February 15, 2012 16:15
Trying to add "last-post" class to the loop
<?php
/**
* Adds Radio Latest News Widget.
*
* @package Radio
* @package Widgets
* @author Greg Rickaby and StudioPress
* @license http://www.opensource.org/licenses/gpl-license.php GPL v2.0 (or later)
* @link http://www.studiopress.com/themes/genesis
*/
@jtsternberg
jtsternberg / radio-latest-news-widget.php
Created February 15, 2012 19:06 — forked from gregrickaby/radio-latest-news-widget.php
If there's no content, don't display [Continue...]
<?php
/**
* Adds Radio Latest News Widget.
*
* @package Radio
* @package Widgets
* @author Greg Rickaby and StudioPress
* @license http://www.opensource.org/licenses/gpl-license.php GPL v2.0 (or later)
* @link http://www.studiopress.com/themes/genesis
*/
@jtsternberg
jtsternberg / radio-latest-news-widget.php
Created February 15, 2012 19:17 — forked from wpsmith/radio-latest-news-widget.php
If there's no content, don't display [Continue...]
if ( ! empty( $instance['show_content'] ) ) {
if ( 'excerpt' == $instance['show_content'] )
the_excerpt();
elseif ( 'content-limit' == $instance['show_content'] && strip_shortcodes( $post->post_content ) != '' ) {
the_content_limit( (int) $instance['content_limit'], esc_html( $instance['more_text'] ) );
}
else
the_content( esc_html( $instance['more_text'] ) );
}
@jtsternberg
jtsternberg / radio-latest-news-widget.php
Created February 15, 2012 19:20 — forked from gregrickaby/radio-latest-news-widget.php
If there's no content, don't display [Continue...]
<?php
/**
* Adds Radio Latest News Widget.
*
* @package Radio
* @package Widgets
* @author Greg Rickaby and StudioPress
* @license http://www.opensource.org/licenses/gpl-license.php GPL v2.0 (or later)
* @link http://www.studiopress.com/themes/genesis
*/
@jtsternberg
jtsternberg / radio-latest-news-widget.php
Created February 15, 2012 19:30 — forked from wpsmith/radio-latest-news-widget.php
If there's no content, don't display [Continue...]
if ( ! empty( $instance['show_content'] ) ) {
if ( 'excerpt' == $instance['show_content'] ) {
the_excerpt();
} elseif ( 'content-limit' == $instance['show_content'] {
if ( strip_shortcodes( get_the_content() ) != '' ) {
the_content_limit( (int) $instance['content_limit'], esc_html( $instance['more_text'] ) );
} elseif ( get_the_content() != '' && strip_shortcodes( get_the_content() ) == '' ) {
// do nothing
}
} else {
@jtsternberg
jtsternberg / Genesis Mondo Featured Posts Widget
Created February 15, 2012 19:49
Mondo Genesis Featured Posts widget with custom post type and custom taxonomy support
@jtsternberg
jtsternberg / front.php
Created February 16, 2012 15:58
If the option is empty, don't display
<?php if ( $station_phone = genesis_get_option( 'station_phone' ) ) { ?>
<div class="live-toolbar-phone alignright">
<span>Request Line: <?php echo $station_phone; ?></span>
</div>
<?php } ?>
@jtsternberg
jtsternberg / gist:1860851
Created February 18, 2012 19:56
Use wp_editor internal linking for metabox. Still a work in progress (adds autop when visual editor is selected)
function nbc_dynamic_lead_link_meta_box( $post ) {
global $post;
// Use nonce for verification
wp_nonce_field( basename( __FILE__ ), 'nbc_dynamic_lead_link_nonce' );
$link = get_post_meta( $post->ID, 'lead_link', true );
$settings = array(
'media_buttons' => false,