0

I have the following CSS conditional statement in my function.php file:

 function logo_exists() {
 global $options;
    ?><style type="text/css">
  #header h1 a {
  <?php
  if ( $options['logo'] == NULL ) { ?>
      float: left;
   text-indent: 0;
  <?php } else { ?>
   background: url(<?php echo $options['logo']; ?>) no-repeat scroll 0 0;
   float: left;
   text-indent: -9999px;
   width: 160px;
   height: 80px;
  }
  <?php } ?>
    </style><?php
}

example:

        (...same code as above...)

       width: 160px;
       height: 80px;
      }
      <?php } ?>
        </style><?php

        add_option('logo_exists');

}

I'm not sure how to "add" or "initialise" it.

I tried: add_option('logo_exists'); and add_action('logo_exists'); but it didn't work.

What's the Wordpress "add" command for conditional CSS statements in the function.php file?

2

1 Answer 1

1

Instead of using this variation, you could use wordpress conditions: is_home() is_singular() (for page/article) is_single() is_page() ad so on.

Besides that, WP automatically add an extra class to body element and you can relate to that to build your css selectors.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.