• Resolved aliceralph

    (@aliceralph)


    Hello

    This has completely baffled me for the last day.

    I am building on a localhost and then using Subversion (Cornerstone & Deploy) to upload to my Dev site.

    For my posts/single.php I am using the following code in the header to call different headers:

    <?php
    if ( has_post_thumbnail()) {
    get_header('Single');
    } else {
    get_header('Inner');
    }
    ?>

    Basically I have two custom headers, ‘Inner’ and ‘Single’. ‘Single’ displays the Featured Image within the header. If there isn’t a Featured Image then it defaults to the ‘Inner’ custom header which displays a default header for all internal pages (which is different to header.php, which I only use on the homepage…!) Everyone keeping up? ??

    So the bit of code above checks whether the post has a Featured Image or not. If it does then it uses ‘Single’, if not it uses ‘Inner’.

    This works absolutely fine on my localhost build! Hurrah!

    HOWEVER (here’s the twist…)

    …when I deploy it to my Dev site, it doesn’t use either ‘Single’ or ‘Inner’. It defaults to header.php. I am only using header.php on the home page as it has a slideshow plugin built into it. I have double checked via FTP and it using the exact same files as my localhost (incl the same version of single.php). I have tried clearing caches and using different browsers, even different computers.

    This is so weird as the only thing that has changed is the hosting server and the .htaccess (as the Dev directory is password protected). I am using the exact same database and version of WordPress. Could this be PHP 4/5 related? Why would it cause that?

    ANY help very very gratefully received as I am totally stumped!

    Thank-you in advance

    Alice

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter aliceralph

    (@aliceralph)

    PS. I am using Featured Content Slider plugin in my header.php file. Could that be a culprit?

    Thread Starter aliceralph

    (@aliceralph)

    Okay after 2 days I have just fixed this!! *high fives myself*

    If anybody else ever has the same problem… it was actually the bit of code above. I changed it from above to this:

    <?php
    if ( has_post_thumbnail()) {
    include("header-single.php");
    } else {
    include("header-inner.php");
    }
    ?>

    Even though this renders exactly the same on my localhost, it now works on my Dev host. I presume this is a PHP thing that meant it wasn’t being read properly for some reason.

    I still have no idea how or why this happened but that was the fix. SO SATISFYING!!!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Calling wrong Header.php file?’ is closed to new replies.