-2

I want to know how to run the PHP function in a WordPress CSS file. Because I want to add images by running the PHP function.

**Below are my CSS codes:**

 

    .hero {
      width: 100%;
      height: 100vh;
      background: URL(<?php echo get_theme_mod( '......' ); ?>) top center no-repeat;
      background-size: cover;
    }
  • I would suggest editing your css using Javascript (which will be usable within your .php file). – EKrol Oct 08 '21 at 21:55

1 Answers1

1

css files are not parsed by php interpreter. only files with .php ending will processed by php. you have to type the full path to the backgroundn image on your own.