Created
March 28, 2013 21:22
-
-
Save dipakcg/5266925 to your computer and use it in GitHub Desktop.
WordPress - Modify main theme shortcode through child theme. (eg. To modify "intro_btn_name" shortcode of main theme, use following code under child theme's functions.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
add_action( 'after_setup_theme', 'themewerx_child_theme_setup' ); | |
function themewerx_child_theme_setup() { | |
remove_shortcode( 'intro_btn_name' ); | |
add_shortcode( 'intro_btn_name', 'themewerx_intro_btn_name' ); | |
} | |
function themewerx_intro_btn_name( $atts, $content = null ) { | |
global $intro_btn; | |
extract( shortcode_atts( array( | |
'url' => '#' | |
), $atts ) ); | |
$intro_btn = '<a class="button theme-button" href="'.esc_attr($url).'">'.$content.'</a>'; | |
return $intro_btn; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment