Revisions
- August 6, 2012 @ 12:48:19 [Current Revision] by PeterLugg
- August 6, 2012 @ 12:44:32 by PeterLugg
Revision Differences
August 6, 2012 @ 12:44:32 | Current Revision | ||
---|---|---|---|
Content | |||
Added: Here is code frequently used to remove and replace a parent theme filter: | |||
Added: [php]/*------ ------------- ------------ ------------- ------------ ------------- --------------*/ | |||
Added: /* REMOVE & REPLACE A CUSTOM PARENT THEME FILTER */ | |||
Added: /*----------- ------------- ------------ ------------- ------------ ----------------------*/ | |||
Added: // Setup the new function to replace the existing parent theme function | |||
Added: function pp_custom_password_form() { | |||
Added: global $post; | |||
Added: $label = 'pwbox-'.( empty( $post->ID ) ? rand() : $post->ID ); | |||
Added: $o = '<div class="clearfix" ><form class="protected- post-form" action="' . get_option('siteurl') . '/wp-login.php?action= postpass" method=" post"> | |||
Added: ' . __( "<p>This post is password protected. To view it please enter your password below:</p>" ,'bonestheme') . ' | |||
Added: <label for="' . $label . '">' . __( "Password:" ,'bonestheme') . ' </label><div class="input" ><input name="post_ password" id="' . $label . '" type="password" size="20" /><input type="submit" name="Submit" class="btn btn-primary" value="' . esc_attr__( "Submit" ,'bonestheme' ) . '" /></div> | |||
Added: </form> </div> | |||
Added: '; | |||
Added: return $o; | |||
Added: } | |||
Added: // In after_setup_theme remove the parent them filter & add the new function in a filter | |||
Added: add_action( 'after_setup_theme', 'pp_custom_password_form_setup' ); | |||
Added: function pp_custom_password_ form_setup() { | |||
Added: remove_filter( 'the_password_form', 'custom_password_form' ); | |||
Added: add_filter( 'the_password_form', 'pp_custom_password_form' ); | |||
Deleted: | Added: } | ||
Added: [/php] |
Note: Spaces may be added to comparison text to allow better line wrapping.
No comments yet.