user4297805
user4297805

Reputation:

Upgrading Wordpress theme to Genesis Framework + Metro Child theme: Need to migrate shortcodes

Looking for some guidance on how I would go about doing the following: My current theme is just a regular theme (no framework) that uses shortcodes. Currently I am in the process of upgrading and migrating to Genesis + Metro child theme and I need help with one thing.

CURRENT THEME = Sahifa by Tielabs (http://themes.tielabs.com/?theme=sahifa)

I use a [button][/button] shortcode with my CURRENT theme for quite a lot of links on my site. What I would like to do is copy this shortcode from my current theme to the Genesis Framework + Metro Theme so that my buttons don't get messed up.

I would do this manually, but i have a lot of these buttons, so it would take a very long time to go in and change all of it, which would leave my site all messed up while visitors are there.

Here is an example of the shortcode in action:

[button color="red" size="small" link="http://www.example" ]Button Text[/button]

[button color="red" size="big" link="http://www.example" ]Button Text[/button]

Would appreciate any help! Thanks!

Upvotes: 0

Views: 173

Answers (1)

diggy
diggy

Reputation: 6828

You need to copy at least two things to preserve the gist of the shortcode functionality, the relevant add_shortcode() function, and the callback function. You should end up pasting something like the following in the functions.php file of your new theme:

add_shortcode( 'button', 'button_shortcode_callback_func', 10, 2 );
function button_shortcode_callback_func( $atts, $content = null  ){
    // some code here
}

Upvotes: 0

Related Questions