user3076307
user3076307

Reputation:

Wordpress Images path are not working?

I have images working on one server, but they are not working on other server, I don't know what happened..

The images in style.css path is set like this below on both servers. i have rechecked.

.category{ background:url(../images/category-icon.png); background-size:100%;}
.tabs a:hover .category{ background:url(../images/category_dark-icon.png); background-size:100%;}

But on server 1, it works and url becomes like this. It works.

http://demo.server1.com/projects/gamingcafe/wp-content/themes/gamingcafe/images/category-icon.png

but on server 2, it is like this. This is not working.

http://demo.server2.com/projects/gamingcafe/wp-content/themes/images/category-icon.png

My directory style is like this on both servers..

http://demo.server1.com/projects/gamingcafe/wp-content/themes/gamingcafe/css/

http://demo.server1.com/projects/gamingcafe/wp-content/themes/gamingcafe/images/

http://demo.server1.com/projects/gamingcafe/wp-content/themes/gamingcafe/js/

http://demo.server1.com/projects/gamingcafe/wp-content/themes/gamingcafe/less/

same style on server2.

Upvotes: 2

Views: 542

Answers (2)

R.K.Bhardwaj
R.K.Bhardwaj

Reputation: 2192

Step one

First, check into the header.php the file including path correct or not something like this way <link href="<?php echo get_template_directory_uri(); ?>/style.css" rel="stylesheet">.

Step Two

Check your both server 1 & 2 into theme images folder the image should be there into image folder of your theme on both servers

Step Three

You can try this way to call your image into CSS

category{ background:url("<?php bloginfo('template_directory'); ?>/images/category-icon.png"); background-size:100%;}
.tabs a:hover .category{ background:url("<?php bloginfo('template_directory'); ?>/images/category_dark-icon.png"); background-size:100%;}

Step Four

If above methods do not work then use the another way like

<?php bloginfo('template_url'); ?>

Upvotes: 0

Ryan
Ryan

Reputation: 579

It most likely is related to the location in which the style.css file resides.

On server1, is the style.css file in the root of your theme directory, or is it in a sub-directory?

Upvotes: 1

Related Questions