Skip to content

Instantly share code, notes, and snippets.

@billerickson
billerickson / post-listing.php
Created April 14, 2020 14:35
This file (included in functions.php) adds a Post Listing block using ACF. Key points of customization:
<?php
/**
* Post Listing
*
* @package CultivateBlocks
* @author Bill Erickson
* @since 1.0.0
* @license GPL-2.0+
**/
@billerickson
billerickson / functions.php
Last active October 14, 2019 11:46
[display-posts post_type="ai1ec_event"]
<?php
/**
* Display Posts - All in One Event Calendar
* @see https://wordpress.org/support/topic/support-for-all-in-one-event-calendar/
*
* @param array $args, query arguments
* @param array $atts, shortcode attributes
* @return array $args, modified query arguments
*/
@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
//* 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
// 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 );
@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
<?php
/**
* Change DPS titles to h3
*
*/
function be_dps_titles_to_h3( $output, $original_atts, $image, $title, $date, $excerpt, $inner_wrapper, $content, $class ) {
return str_replace( $title, '<h3>' . $title . '</h3>', $output );
}
add_filter( 'display_posts_shortcode_output', 'be_dps_titles_to_h3', 10, 9 );
<?php
//----------------------------------------------------------
// Display Posts Shortcode plugin: add H2 to title
//----------------------------------------------------------
add_filter( 'display_posts_shortcode_output', 'format_dps_title', 10, 9 );
function format_dps_title( $output, $original_atts, $image, $title, $date, $excerpt, $inner_wrapper, $content, $class ) {
// Make Title and H2
$title = ' <h3>'. $title .'</h3>';
<?php
/**
* Template Name: Residential Portfolio
*
*/
remove_action ('genesis_loop', 'genesis_do_loop'); // Remove the standard loop
add_action( 'genesis_loop', 'custom_do_press_loop' ); // Add custom loop
function custom_do_press_loop() {