Skip to content

Instantly share code, notes, and snippets.

View wpspeak's full-sized avatar

WPSpeak wpspeak

View GitHub Profile
@wpspeak
wpspeak / functions.php
Last active August 29, 2015 13:57
Change the number of Related Posts displayed under your posts
<?php
function jetpackme_more_related_posts( $options ) {
$options['size'] = 6;
return $options;
}
add_filter( 'jetpack_relatedposts_filter_options', 'jetpackme_more_related_posts' );
@wpspeak
wpspeak / functions.php
Created February 19, 2014 22:26
Add Footer Menu in Genesis Framework (HTML5)
<?php
//* Register Footer Menu in Genesis Framework (HTML5)
function afn_add_footer_menu () {
echo '<nav class="nav-footer" role="navigation" itemscope itemtype="http://schema.org/SiteNavigationElement">';
wp_nav_menu( array( 'sort_column' => 'menu_order', 'container_id' => 'nav-footer' , 'menu_class' => 'menu genesis-nav-menu menu-footer', 'theme_location' => 'tertiary', 'depth' => '1' ) );
echo '</nav>';
}
add_action('genesis_before_footer', 'afn_add_footer_menu');
@wpspeak
wpspeak / functions.php
Created February 19, 2014 15:19
Set HTML Editor as default post editor
<?php
// Set HTML Editor as default post editor
add_filter( 'wp_default_editor', create_function('', 'return "html";') );
@wpspeak
wpspeak / functions.php
Last active August 29, 2015 13:56
Set Visual editor as default post editor
<?php
// Set Visual editor as default post editor
add_filter( 'wp_default_editor', create_function('', 'return "tinymce";') );
@wpspeak
wpspeak / functions.php
Created February 17, 2014 02:23
Change the Reply Text Link on WordPress Comment
<?php
// Modify the Reply link
function afn_custom_comment_reply($link) {
$link = str_replace('Reply', 'Reply to this comment', $link);
return $link;
}
add_filter('comment_reply_link', 'afn_custom_comment_reply');
@wpspeak
wpspeak / shortcode.php
Created February 9, 2014 15:26
Prevent WordPress From Executing Shortcode in Post
<?php
/**
* Retrieve the shortcode regular expression for searching.
*
* The regular expression combines the shortcode tags in the regular expression
* in a regex class.
*
* The regular expression contains 6 different sub matches to help with parsing.
*
@wpspeak
wpspeak / functions.php
Last active August 29, 2015 13:56
Display custom tax in the entry footer (Genesis Framework - HTML5)
<?php
//* Display custom tax in the entry footer (Genesis Framework - HTML5)
add_filter( 'genesis_post_meta', 'afn_display_custom_tax' );
function afn_display_custom_tax($post_meta) {
$post_meta = '[post_terms taxonomy="type" before="Type: "]';
return $post_meta;
}
@wpspeak
wpspeak / functions.php
Last active August 29, 2015 13:56
Conditionally display custom tax in entry footer (Genesis Framework - HTML5)
<?php
//* Conditionally display custom tax in entry footer (Genesis Framework - HTML5)
function afn_display_conditionals() {
if ( is_singular( 'portfolio' ) || is_post_type_archive( 'portfolio' ) ) {
add_filter('genesis_post_meta', 'afn_display_custom_tax');
}
}
@wpspeak
wpspeak / functions.php
Last active August 29, 2015 13:56
Create A 'Type' Custom Taxonomy
<?php
add_action( 'init', 'afn_register_taxonomy_types' );
function afn_register_taxonomy_types() {
$labels = array(
'name' => _x( 'Types', 'types' ),
'singular_name' => _x( 'Type', 'types' ),
'search_items' => _x( 'Search Types', 'types' ),
@wpspeak
wpspeak / functions.php
Last active August 29, 2015 13:56
Remove comment after and before notes
/<?php
//* Remove comment before and after notes
add_filter( 'comment_form_defaults', 'afn_custom_comment_form' );
function afn_custom_comment_form($fields) {
$fields['comment_notes_before'] = ''; // Removes comment before notes
$fields['comment_notes_after'] = ''; // Removes comment after notes
return $fields;
}