Forums

Question about a functions.php function (1 post)

  1. avanderveen
    Member
    Posted 3 years ago #

    I'm trying to make a function on my WordPress blog where, in the header, I execute this code:
    <?php set_style(); ?>
    before the </head> tag.

    And I have the function defined in the functions.php file as the following:

    function set_style()     // takes a pages name and assigns the appropriate style
    {
      if (strcmp(wp_title('', false), 'Resume')==0)
      {
        ?>
          <link rel="stylesheet" type="text/css" href="/wp-content/themes/aeros/resume.css" />
        <?php
      }
      else
      {
        ?>
          <link rel="stylesheet" type="text/css" href="/wp-content/themes/aeros/style.css" />
        <?php
      }
    }

    For some reason the if-statement in the code above never evaluates to true. I've checked and wp_title('', false) does return "Resume" (without the quotes of course). I've tried checking the expression in the if-statement with just a double-equals (==) instead of using strcmp(), and that doesn't work either.

    Does anyone know what I'm doing wrong here?

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.