Skip to content

Instantly share code, notes, and snippets.

@billerickson
billerickson / gist:3698476
Last active February 23, 2024 16:49 — forked from luetkemj/wp-query-ref.php
WP: Query $args
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.com
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query
* Source: http://core.trac.wordpress.org/browser/tags/3.3.1/wp-includes/query.php
*/
$args = array(
//* Add menu item to header-right menu
add_filter( 'wp_nav_menu_items', 'custom_nav_item', 10, 2 );
function custom_nav_item( $menu, $args ) {
//* make sure we are in the primary menu
if ( 'ana-menu' !== $args->menu ) {
return $menu;
}
//* see if a nav extra was already specified with Theme options
if ( genesis_get_option( 'nav_extras' ) ) {
return $menu;
<?php
/**
* Javascript for Load More
*
*/
function be_load_more_js() {
global $wp_query;
$args = array(
<?php
/* Template Name: Fells */
/**
* My Custom Loop
*
*/
function be_custom_loop() {
$tags = wp_get_post_tags( get_the_ID() );
@billerickson
billerickson / genesis-custom-loop-pagination.php
Created July 31, 2012 15:59
Genesis custom loop with pagination
<?php
/* Template Name: Test */
/**
* Genesis custom loop
*/
function be_custom_loop() {
global $post;
// arguments, adjust as needed
@billerickson
billerickson / functions.php
Last active April 16, 2019 23:09 — forked from graylaurenm/functions.php
Genesis infinite scroll, supporting column classes, custom settings by page, and both auto + button loading
<?php
/**
*
* Infinite Scroll
*
* @since 1.0.0
*
* @author Lauren Gray
* @author Bill Erickson
@billerickson
billerickson / candidate-import.php
Created October 4, 2018 23:48 — forked from amberhinds/candidate-import.php
This is an example of a file that creates new posts in a custom post type from the Eventbrite Attendee API
<?php
function candidate_import($continuation, $event_id, $event_name, $token){
$log;
$log .= 'Event: '.$event_name.'<br />';
//check if API call should be paginated and if so get the continuation key
if(empty($continuation)){
//first page call
@billerickson
billerickson / page_featured_blog.php
Last active July 21, 2018 05:58 — forked from ChristopherNeetz/page_featured_blog.php
Genesis page template with full blog post and additional posts with excerpts
<?php
// This file handles single entries, but only exists for the sake of child theme forward compatibility.
remove_action( 'genesis_entry_header', 'genesis_entry_header_markup_close', 15 );
add_action( 'genesis_entry_header', 'genesis_entry_header_markup_close', 12 );
remove_action( 'genesis_entry_header', 'genesis_post_info', 12 );
add_action( 'genesis_entry_header', 'genesis_post_info', 3 );
<?php
$images = get_post_meta( get_the_ID(), 'images', true );
if ( $images ) {
for( $i = 0; $i < $images; $i++ ) {
$image_name = get_post_meta( get_the_ID(), 'images_' . $i . '_image_name', true );
$image_path = get_post_meta( get_the_ID(), 'images_' . $i . '_image_path', true );