How run shortcode before loading header.php in wordpress? [closed]


guys. I have some situation when my shortcode don't work correctly, if I add shortcode in header, because first of all load header.php and only after that load my shortcode. How can I run shortcode before loading header.php ? I try to use hoocks, but not find solution. Best regards.


If you want to run your code just before your header.php is loaded you can use the get_header hook:

function run_before_header( $name ) { do_shortcode... } add_action( 'get_header', 'run_before_header' );


You have a Widget in the Backend of your WP-Admin and the Widget is called: "my_specials" and you want to display this Widget in the header, right? OK; try doing something like this within the header.php:

<?php // FILENME: header.php ob_start(); dynamic_sidebar('my_specials'); $mySpecials = ob_get_clean(); // NOW YOU HAVE THE CONTENT OF THE 'my_specials' WIDGET IN THAT VARIABLE. // ANY YOU CAN NOW ECHO IT AT THE SECTION OF YOUR CHOOSING LIKE SO: echo $mySpecials

It is imagined that this is what you meant and also hoped that this might help a bit, though...

Good-Luck to you, Mate...


  • wordpress function wp_link_pages not working
  • PHP regex to fix hacked Wordpress site
  • run jekyll --server failed in win7
  • Why __weak object will be added to autorelease pool?
  • Wordpress Category Link get_category_link(id)
  • Morphological Reconstruction in OpenCV
  • Wordpress header external php file - change title?
  • Processing (too) many XML files (with TagSoup)
  • Google Maps v3 with MeteorJS loading sync issue
  • How to hide header on specific page in wordpress
  • ember js subviews and didinsertelement event
  • How to distinguish field that requires null=True when blank=True is set in Django models?
  • Find substring in string using locale
  • Majority function in SQL
  • WordPress MysqlError: Unknown storage engine 'InnoDB' [duplicate]
  • gulp.watch running same task multiple times when saving many files
  • Does argparse support multiple exclusive arguments?
  • Codeigniter Hooks advance
  • Two Tables Serving as one Model in Rails
  • JqueryMobile Popup menu is not working
  • Android - Material Design - NavigationView - How to put vertical scroll?
  • $wpdb not working in file of WordPress plugin
  • Ajax Loaded meta Tags
  • Excel - Autoshape get it's name from cell (value)
  • Check if a string to interpolate provides expected placeholders
  • RestKit - RKRequestDelegate does not exist
  • Traverse Array and Display in markup
  • Cannot Parse HTML Data Using Android / JSOUP
  • File upload with ng-file-upload throwing error
  • Acquiring multiple attributes from .xml file in c#
  • Free memory of cv::Mat loaded using FileStorage API
  • How to CLICK on IE download dialog box i.e.(Open, Save, Save As…)
  • Java static initializers and reflection
  • How can I remove ASP.NET Designer.cs files?
  • Add sale price programmatically to product variations
  • Binding checkboxes to object values in AngularJs
  • java string with new operator and a literal
  • Net Present Value in Excel for Grouped Recurring CF
  • jQuery Masonry / Isotope and fluid images: Momentary overlap on window resize
  • How to load view controller without button in storyboard?