In header.php I have created a div to contain my navigation menu area. Within the div is 1 x do_shortcode and 2 x includes php files. For some reason the last include ('custom-primary-menu.php') is skipping <header id="masthead" and <div id="page" class="hfeed site"> and is only within <div class="col-full">. The other 2 however, appear as they should.

I thought it might have something to do with the open div at the end of the code which is also "col-full" but I tried renaming the first and it made no difference.

?><!doctype html>
<html <?php language_attributes(); ?>>
<meta charset="<?php bloginfo( 'charset' ); ?>">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2.0">
<link rel="profile" href="http://gmpg.org/xfn/11">
<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>">

<?php wp_head(); ?>

<body <?php body_class(); ?>>

<?php do_action( 'storefront_before_site' ); ?>

<div class="col-full">
    <div id="page" class="hfeed site">

        <?php do_action( 'storefront_before_header' ); ?>

        <header id="masthead" class="site-header" role="banner" style="<?php storefront_header_styles(); ?>">


            do_action( 'storefront_header' );

            echo do_shortcode ('[woo_multi_currency_layout5]');
            include ('secondary-icon-menu.php');
            include ('custom-primary-menu.php');

        </header><!-- #masthead -->


    do_action( 'storefront_before_content' );

    <div id="content" class="site-content" tabindex="-1">
        <div class="col-full">

        do_action( 'storefront_content_top' );
  • 1
    I'm not sure about the answer to your include/div question, but please... don't echo do_shortcode(). Just find the callback and use it directly. – butlerblog Dec 3 '19 at 14:08
  • I have searched this plugins files for add_shortcode to find the function and came up with nothing. If I did find it, would I just echo the function name instead? – aye cee Dec 3 '19 at 14:31
  • You could start by just echoing the function name. It'll depend on the actual function and whether it's in a class or not. – butlerblog Dec 3 '19 at 15:18
  • 1
    Code ordering problems sometimes have to do with echoing instead of returning. You might try either echoing all, or returning all, to see if making them all the same puts them all in the same place. – WebElaine Dec 3 '19 at 15:44

ok after days of doing the same thing over and over....commenting out different combinations of files...I realised the problem was actually an extra closing div which the code editor threw in for me in one of the files!!

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.