Title: shortcode in Header
Last modified: August 4, 2025

---

# shortcode in Header

 *  [Павел Ефимов](https://wordpress.org/support/users/efimov2025/)
 * (@efimov2025)
 * [10 months, 2 weeks ago](https://wordpress.org/support/topic/shortcode-in-header-2/)
 * Hi.
 * I can’t display the BelingoGeo plugin on the site in header
 * I use a third-party plugin to display Snippets and I write the following php 
   code there:
 * add_action( ‘ocean_top_bar_content’, ‘add_shortcode_to_top_bar’ );
 * function add_shortcode_to_top_bar() {
   echo do_shortcode( ‘[belingogeo_selector
   show_question=”false”]’ );}
 * But it doesn’t work. Nothing appears on the site. What could be the problem?
 * p.s. WP+OceanWP+Elementor+WoodySnippet+RankMath
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fshortcode-in-header-2%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 1 replies (of 1 total)

 *  [Shahin](https://wordpress.org/support/users/skalanter/)
 * (@skalanter)
 * [10 months, 1 week ago](https://wordpress.org/support/topic/shortcode-in-header-2/#post-18586442)
 * Hello [@efimov2025](https://wordpress.org/support/users/efimov2025/),
 * Thank you for reaching out,
 * The main issue is that the hook `ocean_top_bar_content` you are trying to use
   does not exist in OceanWP, so the PHP code won’t have any effect.
 * If you want to display your shortcode in the Top Bar, the easiest way is to simply
   paste the shortcode directly into the Top Bar Content field in the WordPress 
   Customizer (WP Dashboard > Appearance > Customize > Top Bar). There is no need
   for custom PHP code for this: [https://docs.oceanwp.org/article/900-customizer-top-bar](https://docs.oceanwp.org/article/900-customizer-top-bar)
 * However, if you want to add custom code using hooks, please note the correct 
   hooks related to the Top Bar are (you can search them in OceanWP Docs):
 * ocean_after_top_bar
    ocean_after_top_bar_inner ocean_before_top_bar ocean_before_top_bar_inner
 * You can find more about using hooks here:
    [https://docs.oceanwp.org/article/377-how-to-use-hooks](https://docs.oceanwp.org/article/377-how-to-use-hooks)
   [https://docs.oceanwp.org/category/376-hooks](https://docs.oceanwp.org/category/376-hooks)
 * I recommend using the shortcode inside the Customizer field first, as this is
   the intended way and simpler.
 * Please let me know if you have any questions about the above steps.
 * Hope it helps,
    Best Regards

Viewing 1 replies (of 1 total)

The topic ‘shortcode in Header’ is closed to new replies.

 * ![](https://i0.wp.com/themes.svn.wordpress.org/oceanwp/4.1.6/screenshot.png)
 * OceanWP
 * [Support Threads](https://wordpress.org/support/theme/oceanwp/)
 * [Active Topics](https://wordpress.org/support/theme/oceanwp/active/)
 * [Unresolved Topics](https://wordpress.org/support/theme/oceanwp/unresolved/)
 * [Reviews](https://wordpress.org/support/theme/oceanwp/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [Shahin](https://wordpress.org/support/users/skalanter/)
 * Last activity: [10 months, 1 week ago](https://wordpress.org/support/topic/shortcode-in-header-2/#post-18586442)
 * Status: not resolved