0

I am trying to replace the default Add Media icon in my Wordpress site. I searched for the same on the web and got this:

How to replace default icon on "Add Media" button?

This seems to work for the OP, and ofcourse should've worked for others too. But, I am getting confused as the answer contains words like Child Theme and all. I could understand the first part of the answer, but I lost the track when the answer talked about this:

wp_enqueue_style('my-css', get_stylesheet_directory_uri().'/css/my-admin.css'

From where did this part of the url came: '/css/my-admin.css. I searched in my database at the backend but couldn't find this particular file anywhere. I know this might be a silly thing to ask, but this is it. Can someone help in this regard?

2 Answers 2

1

this function get_stylesheet_directory_uri() return URI to current theme's stylesheet directory and /css/my-admin.css is path to their file which you can create in your theme directory example :

<link rel="stylesheet" type="text/css" id="my-css" href="https://yourdomain.com/wp-content/themes/yourtheme/css/my-admin.css">

this is the output of the code in your source

3
  • I created the my-admin.css file in my backend and entered the css code there. Changed the content to another dashicon too. Didn't work. What did I miss?
    – Sanu_012
    Commented Jul 11, 2021 at 15:14
  • can you see my-admin.css when you see page source ? if you can you should make check your css code Commented Jul 11, 2021 at 15:25
  • Thanks, it worked. However, a new issue popped up: wordpress.stackexchange.com/questions/392077/…
    – Sanu_012
    Commented Jul 17, 2021 at 12:00
1

/css/my-admin.css is located in the current theme directory as specified from the return value of get_stylesheet_directory_uri() prepended to this path.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.