Title: Call CSS with a PHP function
Last modified: August 20, 2016

---

# Call CSS with a PHP function

 *  Resolved [cacoline](https://wordpress.org/support/users/cacoline/)
 * (@cacoline)
 * [14 years, 8 months ago](https://wordpress.org/support/topic/call-css-with-a-php-function/)
 * Hello everyone,
 * I have a code that enables me to change my CSS for every new visit.
    Here it 
   is:
 * _[code moderated per forum rules - please read [http://codex.wordpress.org/Forum\_Welcome#Posting\_Code](http://codex.wordpress.org/Forum_Welcome#Posting_Code)
   for posting code]_
 * When I use it on a regular php page, I call my CSS using this `<link rel="stylesheet"
   type="text/css" media="screen,projection" href="<?php echo $themecss; ?>">`
 * However, when I want to use it in WordPress, this doesn't work. I guess I should
   use a WordPress funtion to call it, but I can't find how to do it.
    Anyone can
   help me on this? I hope my English is okay and you understand what I mean....

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [Michael](https://wordpress.org/support/users/alchymyth/)
 * (@alchymyth)
 * [14 years, 8 months ago](https://wordpress.org/support/topic/call-css-with-a-php-function/#post-2229882)
 * you might need to add an absolute path to the stylesheet;
 * example:
 *     ```
       <link rel="stylesheet" type="text/css" media="screen,projection" href="<?php echo get_stylesheet_directory_uri() . '/' . $themecss; ?>">
       ```
   
 * [http://codex.wordpress.org/Function_Reference/get_stylesheet_directory_uri](http://codex.wordpress.org/Function_Reference/get_stylesheet_directory_uri)
 *  Thread Starter [cacoline](https://wordpress.org/support/users/cacoline/)
 * (@cacoline)
 * [14 years, 8 months ago](https://wordpress.org/support/topic/call-css-with-a-php-function/#post-2230043)
 * Thank you very much! That’s exactly what I was looking for. I had found the WordPress
   function, but didn’t know how to use it.
    I didn’t know how to write this part
   of code: `. '/' . $themecss; ?>` It works perfectly!

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Call CSS with a PHP function’ is closed to new replies.

## Tags

 * [css](https://wordpress.org/support/topic-tag/css/)
 * [php](https://wordpress.org/support/topic-tag/php/)

 * 2 replies
 * 2 participants
 * Last reply from: [cacoline](https://wordpress.org/support/users/cacoline/)
 * Last activity: [14 years, 8 months ago](https://wordpress.org/support/topic/call-css-with-a-php-function/#post-2230043)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
