Viewing 5 replies - 1 through 5 (of 5 total)
  • Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    if ($file !== FALSE) is wrong.

    Try if (file_exists($file)) instead.

    Otto is right. But also in the future, when using boolean statements, you generally only use 2 symbols at the MAX. So NOT EQUAL is “!=” and EQUAL is “==”.

    Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    Mxsix: No, the two symbol versions test for equality, the three symbol versions test for identity.

    In PHP, zero can equal false. So can the empty string, an empty array, etc. If you want to check for an actual false only, then === or !== is the correct way to do it.

    Thanks for the correction Otto, as soon as I posted, I thought I may have thrown out a big assumption there. Cheers.

    Thread Starter oldcastle

    (@oldcastle)

    Thanks for your help.

    I tried the following code, but its shows directly the bloginfo.


    <?php
    $file = get_bloginfo('stylesheet_directory') . "/images/logo.png";
    if (file_exists($file)) { ?>
    <img src="<?php bloginfo('template_directory'); ?>/images/logo.png" alt="Logo" />
    <?php } else { ?>
    <h1>/"><?php bloginfo('name'); ?></h1>
    <h2><?php bloginfo('description'); ?></h2>
    <?php } ?>

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Help me. How do I get the logo?’ is closed to new replies.