Shortcodes in topbar

I am using some code that you all provided to me so I am able to use icons shortcodes in the topbar. I extracted it from another site that it works on just fine. It does not work the same way on this site and I cannot figure out why. I have been trying to make it work for hours and am missing something…just not sure what something is.

Code I have added to the functions.php file in my child theme:

// Allow shortcodes in the topbar content
// =============================================================================
function allow_custom_shortcodes($contents) {
  $contents = do_shortcode($contents);
  return $contents;
add_filter('x_option_x_topbar_content', 'allow_custom_shortcodes');
// =============================================================================

It is exactly the same code I used on the site it works fine on.

Site it works on -
Site it has the same code in the functions file and it is not working on -

I also found other code on the forum and tried it but no success. Thanks in advance for your assistance.

Hello @kstidham,

Thanks for writing in! Please double check the shortcode. You may have inserted incorrect characters like quotes or commas in HTML form. To better assist you with your issue, kindly provide us access to your site so that we can check your settings. Please create a secure note with the following info:
– Link to your site
– WP login URL
– WP username
– WP password
– WP Administrator Role

To know how to create a secure note, please check this out: How The Forum Works

Best Regards.

Hi @kstidham,

Thanks for providing all the information but we can’t see your theme editor to check the code in the functions.php. I suggest that you allow the files to edit, to do that please go to your root directory and in the wp-config.php files add find the code ‘DISALLOW_FILE_EDIT’ and set it to true define( ‘DISALLOW_FILE_EDIT’, true);

Thank you.

Hey Marc_a, My bad. The security plugin was blocking access from within the dashboard. Editing files is now available from the dashboard.

Thank you.

I figured out where the issue was. Thank you for your willingness to help.

Hi @kstidham,

We’re glad that you’re able to solve your issue. If you have any other concerns, feel free to reach us.

Thank you.

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