Wordpress on localhost, wrong path to images - wordpress

after a great deal of time, I managed to set up my wordpress on localhost running xampp. The thing is now that I don't see any pictures or posts on my local copy. Via dev tools, I realised the path to the content looked like this:
wordpress.localhost/wordpress.localhost/wp-content/...
If it wasn't for the doubled "wordpress.localhost", I'd be able to see it. What might cause this? Is this due to an error in the database? How do I fix it?
Thank you!
Best wishes

Make sure you have properly set your site name under the settings > General > Site Address : http://wordpress.localhost

Images src must be like the following if images are inside your theme folder.
<img src="<?php echo get_stylesheet_directory_uri(); ?>/images-folder/image.png" alt="">
Change the image path as per your requirements.
get_stylesheet_directory_uri() returns your active theme path.

Related

WordPress: Images and other assets not loading on localhost

First of all, a cordial greeting, friends! I have a problem, I am working with the design of a web page using WordPress via localhost with XAMPP. I have tried to view the project from different devices (cellphones, tablets) and by configuring the file httpd-XAMPP.config I have managed to enter the address correctly of the project.
The problem is that no image, icon, or logo that I have placed on the page loads (as seen in the attached image), the menu button does not work either.
With nothing more to add and thanking you in advance for any help you can provide, I say goodbye.
Have you checked the image path to see if it's correct?
Are you able to access the image from the full path in a browser for example
domain.com/wp-content/uploads/image.png like this?
Probable solution 1:
Most of the cases, it can be the permalink issue.
Please try to check by changing the permalink, first make it Plain Text and check, if it's not working then make it Post Name and then check. (To do it go to Admin dashboard > Settings > Permalink)
Probable solution 2:
Sometimes, if the image and CSS do not exist in the correct location then happen this kind of issue. Please check it.
Probable solution 3:
Put it in the config.php file
define('WP_HOME','yourdomain.com');
define('WP_SITEURL','yourdomain.com');
Thank you

Problems with css inside a directory

I have a problem where I want to redirect to a css file which stylesheet link is inside essentials.php in the main directory. however when including the essentials.php the browser redirects to the wrong url see image. how can i fix this?
I fixed my issue with a php variable $site which is defined as the url, in this way i can change the variable from localhost to the real site and is it easy to switch. In this way I do not have directory problems since the whole url is given.
$siteurl=localhost/project
href="<?php echo "$siteurl";?>/videos/watch?v=">

How do I set the image path in WordPress?

I am using absolute paths for images on a WordPress site (currently in dev) but when the page loads the images are missing.
Here is an example:
<img src="/images/img_tonsmeire-properties.png" alt="tonismere" >
The only thing I can think that may be causing this is that the dev environment that I am creating this in is not at the root of the parent site. The URL for this is is:
http://opteracreative.com/~baybr/
What is the correct way to reference the images?
Thanks.
The problem was with the path. I had to add /~baybr/ in front of the image path and it worked.

Wordpress Image Paths

I'm currently developing a new site on Wordpress to replace an old Drupal site. The site is currently being developed on 'dev.website.com', and will be moved to 'website.com' once completed.
I'd like to use a relative image path like 'images/logo.png' instead of the absolute path as it'll make the switch a lot easier, as I won't have to manually remove 'dev.' before every single reference to a file path on the site.
Is there a plugin to do this, or a setting within the Wordpress admin itself? I've looked at loads of articles but they seem to be pretty complex for what I thought could be a simple fix.
Any help would be massively appreciated!
Here is simple solution for importing images
<img src="<?php bloginfo('template_directory');?>/images/image.jpg">
I always use <?php bloginfo('stylesheet_directoy'); ?>/images/image.jpg I create a lot of child themes and this works perfectly.
You can also define a constant with define(IMGPATH, STYLESHEETPATH . '/images'); and use something <?php IMGPATH . '/logo.png';
STYLESHEETPATH is a constant that WordPress uses.

Drupal Imagecache not working

I created an Imagecache setting that just resizes to 125px wide. First issue is that the preview image is 404.
Then I want to print out an image via
<?php print theme('imagecache', 'imported_image', $node->picture, 'test', 'test', $attributes); ?>
'imported_image' being the preset and $node->picture is a correct path. The html prints out ok but the path it's trying load the image from does not exist. In sites/default/files/imagecache there is no folder with the name of the preset. Flushing the preset does nothing. The imagecache folder is writeable by everyone. This is on MAMP.
Anyone know what the issue could be?
Imagecache does not work when friendly url's are off. If this is the case, it can not 'find' the path to its folder in sites/default/files. When I turned them on, the folder with the name of the setting was created ok. The Imagecached images don't appear in here though. I'm putting it down to switching dev from Win to Mac, as a few people suggested on the Drupal forums.
posting last comment as an answer for ease in finding
Try to enable Lighttpd's "url.rewrite-if-not-file" directive
I posted it right here:
http://www.warp1337.com/content/solved-lighttpd-drupal-7-imagecache-images-are-broken-errorhandler404

Resources