Skip to content

Instantly share code, notes, and snippets.

@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>
@luetkemj
luetkemj / wp-query-ref.php
Last active May 25, 2024 10:56
WP: Query $args
// This gist is now maintained on github at https://github.com/luetkemj/wp-query-ref
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.github.io
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query#Parameters
* Source: https://core.trac.wordpress.org/browser/tags/4.9.4/src/wp-includes/query.php
*/
@gregrickaby
gregrickaby / functions.php
Created March 21, 2012 19:19
Genesis Comments Form
add_filter( 'genesis_comment_form_args', 'child_comment_form' );
/**
* Change "Post Comment" button text.
*
* @author Greg Rickaby
* @since 1.0.0
*/
function child_comment_form($args) {
$args = array (
'label_submit' => __( 'Submit', 'genesis' ),
@remkus
remkus / gist:2157116
Created March 22, 2012 08:23
Adding Widget Area in between Grid
<?php
add_action( 'genesis_after_post','ecowijs_add_widget_area_between_grid' );
/**
* The ecowijs_add_widget_area_between_grid function is all about
* dAdding Widget Area between Genesis Featured and Genesis Gri
*
* @access public
* @return void
*/
@remkus
remkus / add-menu.php
Created March 22, 2012 18:59
Pre populate Custom Menus
<?php
add_action( 'init', 'add_menus' );
function add_menus() {
register_nav_menus( array( 'main_nav' =--> 'The main menu', ) );
$new_menu_id = wp_create_nav_menu( 'Main Menu' );
@vc27
vc27 / oembed-post-meta
Created March 24, 2012 17:05
Adds a custom metabox to specified post_types allowing for youtube and vimeo oembed to be saved as hidden postmeta. Returns visalbe video url and video
<?php
/*
Plugin Name: Oembed as Post Meta
Author: Randy Hicks
Plugin URI: http://visualcoma.com
Author URI: http://visualcoma.com
Version: 0.2
Updated: 09.29.12
Description: Adds a custom metabox to specified post_types allowing for youtube and vimeo oembed
to be saved as hidden postmeta. Returns visalbe video url and video thumbnail.
@remkus
remkus / gist:2580322
Created May 2, 2012 20:42
Filter one Post Format via a Custom Loop.
<?php
$args = array(
'post_type' => 'post',
'post_status' => 'publish',
'order' => 'DESC',
'tax_query' => array(
array(
'taxonomy' => 'post_format',
'field' => 'slug',
@gregrickaby
gregrickaby / home.php
Created June 3, 2012 04:02 — forked from jtsternberg/home.php
Genesis Custom Loop w/ Featured Image and Odd/Even support
<?php
$odd_or_even = 'even';
$args = array(
'cat' => 1,
'posts_per_page' => 2,
'order' => 'DESC'
);
$query = new WP_Query( $args );
if ( $query->have_posts() ) : while ( $query->have_posts() ) : $query->the_post();
@remkus
remkus / functions.php
Created June 5, 2012 18:41 — forked from gregrickaby/functions.php
Custom Post-Info with Google Rich Snippet support
remove_action( 'genesis_before_post_content', 'genesis_post_info' );
add_action( 'genesis_before_post_content', 'child_post_info' );
/**
* Custom Post-Info with Google Rich Snippet support
*
* @author Greg Rickaby
* @since 1.0.0
*/
function child_post_info() {
if ( is_page() )
@remkus
remkus / gist:2941390
Created June 16, 2012 13:55
Add WordPress' thickbox
<?php
add_action( 'init','fsm_thickbox' );
/**
* fsm_thickbox function.
*
* @access public
* @param mixed $text
* @return void