Button Shortcode Conflict

Hi,

not sure what’s happening here. I’ve got a custom button shortcode that has the class hardcoded as <a class="ofh_sc_button"> but it’s getting overwritten by .x-btn class.

I’ve tried removing the x_button shortcode but that doesn’t work…is there some JS that’s overwriting what I’m trying to do?

You can see the issue here—https://abc5319.sg-host.com/a-great-page/

The button shortcode is
[button link="https://www.mightycause.com/event/C7jvff" fill="true" label="DONATE NOW" style="crimson" target="new"]

Expected output (from php) is
return '<a class="ofh-sc-button ' . $fill_class . ' ' . $style . '" href="' . $link . '" ' . $target_state . '>' . $label . '</a>;

Actual output (html) is
<a class="x-btn" style="crimson" href="#" target="_blank" rel="" data-options="thumbnail: ''"></a>

Hey @kjroelke,

Thanks for reaching out!

I check your page but it is showing not found. I believe that this page is still set as a draft? That being said, we need the admin credentials to check the page properly. To do that, please give us the following information in a Secure Note.

  • WordPress Login URL
  • Admin level username and password

You can find the Secure Note button at the bottom of your posts.

Thank you.

Ah, sorry about that.

You can see the issue at https://abc5319.sg-host.com/events/scouting-for-food-2022/

Credentials attached to this reply.

Hello @kjroelke,

Instead of using this add_shortcode('button', 'ofh_sc_button');, you should use your own custom button shortcode like add_shortcode('ofh_sc_button', 'ofh_sc_button'); to prevent any conflict and incompatibility. Once you change that, you button shortcode will be like this:

[ofh_sc_button link="https://www.mightycause.com/event/C7jvff" fill="true" label="DONATE NOW" style="crimson" target="blank"]

I am also seeing other custom shortcodes which I think you need to make sure that they have their own unique and different shortcode name to prevent any conflict with the theme’s built-in shortcodes.

Kindly let us know how it goes.

The problem is I’m trying to migrate a client’s site away from a custom-built WP theme into a Child Theme of Pro. This site is very old and has lots of posts/pages that may use this shortcode, and I’d like to find a solution that doesn’t have myself or my client’s employees scrubbing through every post for the possibility of a shortcode if I change the implementation.

Any thoughts?

Hey @kjroelke,

I don’t see any option to automatically change the shortcode implementation from the old code. I suggest that you audit every page and post and change the old implementation of the button to your new way.

Hope that helps.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.