Skip to content

Instantly share code, notes, and snippets.

@dipakcg
Created March 28, 2013 21:22
Show Gist options
  • Save dipakcg/5266925 to your computer and use it in GitHub Desktop.
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)
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