This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Remove Parent Theme Page Template | |
* | |
* @link http://wordpress.stackexchange.com/questions/13671/how-to-remove-a-parent-theme-page-template-from-a-child-theme#141654 | |
**/ | |
add_filter( 'theme_page_templates', 'jdn_remove_page_templates' ); | |
function jdn_remove_page_templates( $templates ) { | |
unset( $templates['templates/page-template.php'] ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Shortcode to create a list or dropdown link to taxonomy archives | |
* | |
* @author Joshua David Nelson, josh@jdn.im | |
**/ | |
function jdn_taxonomy_list( $atts ) { | |
$a = shortcode_atts( array( | |
'taxonomy' => '', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Removes parent theme page templates from the dropdown option on add new/edit page screen. | |
* | |
* Note that the path/to/ is from the parent theme directory, so if the page templates are in a subdirectory add that path, | |
* otherwise it can be written as 'page-template.php' | |
* | |
* @author Joshua David Nelson, josh@jdn.im | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Registering meta boxes, based on these metaboxes: | |
* @link http://www.deluxeblogtips.com/meta-box/docs/define-meta-boxes | |
*/ | |
// Add new metaboxes | |
add_action( 'admin_init', 'jdn_modify_metabox_fields', 1 ); | |
/** | |
* Modify exist metaboxes to include a new field | |
* @author Joshua David Nelson, josh@joshuadnelson.com |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Function to search for a metabox field and return the key | |
* | |
* @link http://stackoverflow.com/questions/8102221/php-multidimensional-array-searching-find-key-by-specific-value | |
*/ | |
function jdn_find_in_array( $array, $needle, $term ) { | |
foreach( $array as $key => $value ) { | |
if ( $value[ $term ] === $needle ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Basic Theme Support usage. Add this to your functions.php file | |
*/ | |
add_theme_support( 'custom-footer-text' ); | |
/** | |
* Elsewhere in your theme... | |
*/ | |
if( current_theme_supports( 'custom-footer-text' ) ) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Force SSL on all pages | |
* | |
* @author Joshua David Nelson, joshuadnelson.com | |
**/ | |
add_action( 'template_redirect', 'jdn_force_ssl' ); | |
function jdn_force_ssl() { | |
// force all pages to https:// |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Disable pingbacks | |
* | |
* Useful to secure your site from *potential* xmprpc DDoS attacks, but it does disable the pingback feature and could conflict with other plugins | |
* | |
* http://l.jdn.im/disable-pinkback | |
**/ | |
add_filter( 'xmlrpc_methods', function( $methods ) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Change the way a field is rendered in Gravity Forms. | |
* | |
* This example shows how you would dynamically create options for a select field. | |
* | |
* @author Joshua David Nelson, josh@joshuadnelson.com | |
* @link | |
*/ |