Skip to content

Instantly share code, notes, and snippets.

View mjsdiaz's full-sized avatar

Marcy Diaz mjsdiaz

View GitHub Profile
@nickcernis
nickcernis / functions.php
Last active May 26, 2018 19:18
Add a login/logout link to the menu bar of any Genesis child theme
<?php // add everything except for this opening line to your functions file
add_filter( 'wp_nav_menu_items', 'sp_add_loginout_link', 10, 2 );
function sp_add_loginout_link( $items, $args ) {
// Change 'primary' to 'secondary' to put the login link in your secondary nav bar.
if ( $args->theme_location != 'primary' ) {
return $items;
}
<?php
/**
* Get post image.
*/
function wds_get_post_image( $size = 'thumbnail' ) {
// If featured image is present, use that
if ( has_post_thumbnail() ) {
return get_the_post_thumbnail( $size );
//* Filter the property details array
add_filter( 'agentpress_property_details', 'agentpress_property_details_filter' );
function agentpress_property_details_filter( $details ) {
$details['col1'] = array(
__( 'Price:', 'agentpress' ) => '_listing_price',
__( 'Address:', 'agentpress' ) => '_listing_address',
__( 'City:', 'agentpress' ) => '_listing_city',
__( 'State:', 'agentpress' ) => '_listing_state',
__( 'ZIP:', 'agentpress' ) => '_listing_zip',
@studiopress
studiopress / nav-extras.php
Last active September 11, 2023 21:24
Modify the nav extras.
<?php
//* Do NOT include the opening php tag shown above. Copy the code shown below.
add_filter( 'wp_nav_menu_items', 'theme_menu_extras', 10, 2 );
/**
* Filter menu items, appending either a search form or today's date.
*
* @param string $menu HTML string of list items.
* @param stdClass $args Menu arguments.
*
@acolson
acolson / last-modified-admin-columns
Last active June 3, 2020 09:49
WordPress sortable custom admin column for last modified date and user
add_filter( 'manage_edit-post_columns', 'aco_last_modified_admin_column' );
// Create the last modified column
function aco_last_modified_admin_column( $columns ) {
$columns['modified-last'] =__( 'Last Modified', 'aco' );
return $columns;
}
add_filter( 'manage_edit-post_sortable_columns', 'aco_sortable_last_modified_column' );
@GaryJones
GaryJones / class-gamajo-template-loader.php
Created December 9, 2013 16:17
Separate out the template loader class into a generic class for all plugins, and a specific one for this plugin.
<?php
/**
* Template Loader for Plugins
*
* @package Template_Loader_For_Plugins
* @author Gary Jones
* @link http://gamajo.com/template-loader
* @copyright 2013 Gary Jones
* @license GPL-2.0+
*/
@GaryJones
GaryJones / functions.php
Last active May 27, 2017 18:13
Genesis: Stop archives from using first attached image as fallback when no featured image is set.
<?php
// Don't include the above.
add_filter( 'genesis_get_image_default_args', 'prefix_stop_auto_featured_image' );
/**
* Stop Genesis archives from using first attached image as fallback when no featured image is set.
*
* @param array $args Default image arguments.
*
@GaryJones
GaryJones / readme.md
Last active July 14, 2019 20:46
Custom Featured Post Widget plugin: Skeleton for amending the output of the Genesis Featured Post widget.
@JiveDig
JiveDig / gist:5557004
Created May 10, 2013 20:03
Remove Jetpack module from Dashboard for non-admins
// Remove Jetpack module from Dashboard for non-admins
function ap_remove_jetpack_page( ) {
if ( class_exists( 'Jetpack' ) && !current_user_can( 'manage_options' ) ) {
remove_menu_page( 'jetpack' );
}
}
add_action( 'admin_menu', 'ap_remove_jetpack_page', 999 );
// Disable OpenGraph in Jetback as written here: http://yoast.com/jetpack-and-wordpress-seo/
add_filter( 'jetpack_enable_opengraph', '__return_false', 99 );
@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(