Skip to content

Instantly share code, notes, and snippets.

View MaruscaGabriel's full-sized avatar

Marusca Gabriel MaruscaGabriel

View GitHub Profile
@MaruscaGabriel
MaruscaGabriel / site-plugin.php
Created February 20, 2015 17:57
How to Create a Site-Specific WordPress Plugin (this file goes in /wp-content/plugins/yoursitename-plugin/)
<?php
/*
Plugin Name: Site Plugin for site.com
Description: Site specific code changes for site.com
*/
/* Start Adding Functions Below this Line */
/* Stop Adding Functions Below this Line */
?>
@MaruscaGabriel
MaruscaGabriel / schema-org-functions.php
Last active August 29, 2015 14:14
Genesis code for schema.org
<?php
// Remove the schema markup from an element
function mg_schema_empty( $attr ) {
$attr['itemtype'] = '';
$attr['itemprop'] = '';
$attr['itemscope'] = '';
return $attr;
}
@MaruscaGabriel
MaruscaGabriel / functions.php
Created February 2, 2015 11:45
Reposition the secondary navigation menu above footer widget in Genesis
<?php
remove_action( 'genesis_after_header', 'genesis_do_subnav' );
add_action( 'genesis_before_footer', 'genesis_do_subnav', 5 );
@MaruscaGabriel
MaruscaGabriel / functions.php
Created January 26, 2015 19:12
Relocate titles under Header on page, post and other single pages
<?php
add_action( 'genesis_after_header','relocate_entry_title_singular' );
function relocate_entry_title_singular() {
if ( ! is_singular() )
return;
echo '<div class="entry-header-wrapper"><div class="wrap">';
genesis_do_post_title();
echo '</div></div>';
@MaruscaGabriel
MaruscaGabriel / Hooks
Last active August 29, 2015 14:14
Genesis Post hooks 2.0 and Legacy
<?php
// HTML5 Hooks
add_action( 'genesis_entry_header', 'genesis_do_post_format_image', 4 );
add_action( 'genesis_entry_header', 'genesis_entry_header_markup_open', 5 );
add_action( 'genesis_entry_header', 'genesis_entry_header_markup_close', 15 );
add_action( 'genesis_entry_header', 'genesis_do_post_title' );
add_action( 'genesis_entry_header', 'genesis_post_info', 12 );
add_action( 'genesis_entry_content', 'genesis_do_post_image', 8 );
add_action( 'genesis_entry_content', 'genesis_do_post_content' );
@MaruscaGabriel
MaruscaGabriel / functions.php
Created January 26, 2015 16:26
Automatically display titles on category, tag and taxonomy archives
<?php
/**
* Default Category Title in Genesis
*
* @author Marusca Gabriel
*/
function mg_default_category_title( $headline, $term ) {
if( ( is_category() || is_tag() || is_tax() ) && empty( $headline ) )
$headline = $term->name;
<?php
/**
* Default Term Description
*
*/
function mg_default_term_description( $desc, $term ) {
if( ( is_category() || is_tag() || is_tax() ) && empty( $desc ) )
$desc = $term->description;