Skip to content

Instantly share code, notes, and snippets.

@calliaweb
calliaweb / jmw-sort-users.php
Last active August 29, 2015 14:13
Sort users by last name and then first name
<?php
function nm2_people_page() {
// Get all user IDs
$args = array(
'fields' => 'ID',
);
$pids = get_users( $args );
@calliaweb
calliaweb / add-title-above-posts-only-if-there-are-posts.php
Last active August 29, 2015 14:13
Add title above posts only if there are posts
<?php
//* Do NOT include the opening php tag
add_action( 'genesis_before_while', 'custom_add_title_before_loop' );
/*
* Echo out the title
* The genesis_before_while runs after the if( have_posts() )
* and before while( have_posts() ) : the_post();
*/
function custom_add_title_before_loop() {
<?php
/**
* Display alphabetical list of tags.
* Template Name: Tag Index
* @author Joanne Waltham
*/
remove_action( 'genesis_loop', 'genesis_do_loop' );
add_action( 'genesis_loop', 'jmw_do_tag_index_loop' );
@calliaweb
calliaweb / 0_reuse_code.js
Last active August 29, 2015 14:26
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
<?php
// Remove the date and time on comments in Genesis child themes
add_filter( 'genesis_show_comment_date', '__return_false' );
<?php
add_filter( 'genesis_show_comment_date', 'jmw_show_comment_date_with_link' );
/**
* Show Comment Date with link but without the time
*
* Stop the output of the Genesis core comment dates and outputs comments with date and link only.
* The genesis_show_comment_date filter was introduced in Genesis 2.2 (will not work with older versions)
*
* @author Jo Waltham
<?php
/**
* Allows developer to control whether to print the comment date.
*
* @since 2.2.0
*
* @param boolean $comment_date Whether to print the comment date
* @param string $post_type The current post type
*/
@calliaweb
calliaweb / genesis-site-description-line-break.php
Created April 2, 2016 12:50
Add line break to site description at "--" in Genesis child themes
<?php
add_filter( 'genesis_seo_description', 'jmw_site_description', 10, 3 );
/**
* Add line break to site description at "--" in Genesis child themes
* @link http://www.jowaltham.com/line-break-site-description-genesis
*
* @param string $description The html string that is output as the site description
* @param string $inside The site description in General Settings
* @param string $wrap The html string to wrap around the site description
<?php
add_filter( 'widget_tag_cloud_args', 'jmw_exclude_tag_from_tag_cloud');
function jmw_exclude_tag_from_tag_cloud( $args ) {
$args[ 'exclude' ] = '36'; // ID of the tag. If multiple tags use comma delimited sting '2,5,36'
return $args;
}
/*
* Other arguments that can be changed