I created slider on masterpage, the images of the slider are inside "slider images" folder. my default page is naked in the solution explorer. so the slider works fine there. but my "About US" page is inside new folder and the problem is the slider doesnot show images on the about us page. can anyone help please..[![enter image description here][1]][1]
You can either use the ~ to point back to the root folder or make use of the .net ResolveClientUrl
<img src="~/slider images/02.jpg" alt="Image is Broken"/>
OR
<img src='<%=ResolveClientUrl("slider images/02.jpg")%>' alt="Image is Broken"/>
And if possible then remove the space from the name of the folder.
Related
I am using this code to display image in my Gallery View but unfortunately i its shows blank infact it does not show any kind of error.
<img src="#Url.Content("~/Content/images/b.jpg")" alt="">
The Code which i am using in my project.
Create a folder in your project called "images", then put the picture you want to display on it and add an existing item to the folder on vs selecting your image.
On the view just use this:
<img src="~/images/yourimagename.jpg or png" alt"">
I have a footer CTA widget (Best Quality Guarantee) that is appearing on all of the pages on my site, besides the shop and product archive pages.
How do I get it to appear on these pages as well?
The code for the widget is here -
<div>
<a class="best-quality-link" href="/best-quality-flowers"><img src="/wp-content/uploads/2018/07/Better.svg" alt="Best Quality Flowers" /></a>
<hr class="separator" />
</div>
You can see the Best Quality image on the bottom of this page - www.flowersforeveryone.co.za
But it doesn't appear on this page - https://flowersforeveryone.co.za/product-category/roses/
looking at your source code on the archive page it shows that better.svg is definiteley there but it looks like your lazy-loading isn't triggering and displaying it as it still has the 'lazy-hidden' class attached to it. Try disabling lazy load and see if it appears. If it does, then try play with your lazy load plugin settings and if that fails try use a different plugin.
I want an image to be displayed when a text is clicked, I have this code at the moment and it works perfectly fine but how would I change the code so I can use a image for my own directory instead of an image from online
<iframe src="" name="bettie"></iframe>
<p>Bettie</p>
Use the local URL instead of the remote URL.
download this image: http://www.bettiepage.com/images/photos/bikini/bikini1.jpg
place it in the same folder/directory as your index.html page
change Bettie
I have a Wordpress website that was customized by a php developer. He created a folder for images in the root of the website. I have a requirement to move this foder from the root of the website to inside the wp-content\images\ folder.
Here is how the php file is written today using the image files from the folder in the root:
<img src="images/img1.jpg" border="0" style="padding-right:44px;"/>
<img src="images/img2.jpg" border="0" style="padding-right:44px;"/>
<img src="images/img3.jpg" border="0" style="padding-right:44px;"/>
<img src="images/img4.jpg" border="0" style="padding-right:44px;"/>
<img src="images/img5.jpg" border="0"/>
Now that I moved the images to the wp-content\images\ folder, I tried many combinations (wp-content/images/img1.jpg; /wp-content/images/img1.jpg; public_html/wp-content/images/img1.jpg;/public_html/wp-content/images/img1.jpg), but the images are not showing up. How should I refer to the images in that folder?
Many thanks!
Rob.
If your images are associated with a custom theme then they should be in your theme directory.
You can use the get_bloginfo wordpress api to get an absolute url to this directory.
bloginfo('template_url')
See the above link for important information on different variations of this.
So you would replace your image links with something like
<img src="<?php bloginfo('template_url')?>/images/img1.jpg" border="0" style="padding-right:44px;"/>
Add Image Directory to Active Theme
Add /images folder to your current active theme.
Add Local Image Directory to Active WordPress Theme (Child)
Optimize Your Images for Production
This is important for user experience and pagespeed. A faster website shows visitors you care about their time. If using the native media manager, there are several free plugins that will optimize your images automatically on upload-- in addition to online services (like TinyPNG), OS applications (like Codekit for Mac, JPEGMini for Windows) and the command line.
Display Local Image in WordPress
If Parent Theme is active: use template_directory
<img src="<?php bloginfo('template_directory')?>/images/YOUR-IMAGE-HERE.jpg" alt="Image Title" border="0" width="" height="" style="padding-right:44px;"/>
If Child Theme is active: use stylesheet_directory
<img src="<?php bloginfo('stylesheet_directory')?>/images/YOUR-IMAGE-HERE.jpg" alt="Image Title" border="0" width="" height="" style="padding-right:44px;"/>
Add this code to your template files where you want your image to display, changing '/images/YOUR-IMAGE-HERE' (and attributes) to match the correct file location, name and attributes:
Include alt, width and height information for every image in production to increase pagespeed and enhance content accessibility.
That's it!
Additional Notes
If using a child theme, you'll want to change template_directory to stylesheet_directory
In most cases you'll want to use the native WordPress media manager to insert and display images. There are also several free plugins that can help you optimize and enhance image quality dynamically:
EWWW Image Optimizer
WP Retina 2x
Regenerate Thumbnails
In addition, WordPress has a list of available parameters that can be used to target a specific (different) directory or url. Check that our here:
http://codex.wordpress.org/Template_Tags/bloginfo
Include image set as separate file for reuse
If reusing this same 'set' of images in several places, create an include file for the set and add them via [shortcode] as needed. To update, you would then only need to update the extended file, which would in turn update all exported code where the [shortcode] has been placed automatically.
<?php include( get_template_directory() . '/includes/myfile.php'); ?>
Best, -K
first time I'm trying to do this so please bear with me :)
I'm building a WordPress theme, and while using wp_nav_menu I'm trying to replace a generated link text with a custom image I made.
So, in essence, what I need done:
1) this text needs to be replaced
2) <img src="<?php bloginfo('template_url'); ?>/images/with-this-image.png" />
I've tried some different tests with jQuery, but I can't find the right combination to make it work.
Any help would be greatly appreciated, thanks!
replace the text that is generated "this text needs to be replaced" with
<img src="/images/with-this-image.png" />
if you want to do it with jquery drop an ID on the a tag and reference that ID.
Create a new menu so you don't overwrite your current one (makes it easier to switch back if you decide to change it.
In the new menu you've created, instead of adding pages or posts the traditional way (using the check-boxes and adding to menu), you can use this method:
Open a blank page (it won't be saved, it's just easier to get the html code for the next step). With the blank page open, click HTML to enter HTML view. Now upload the image you want to use for the navigation link. Copy the html code (make sure you don't copy the P Tags. The coppied result would look something like this:
<img src="http://yoursite.com/wp-content/uploads/2011/08/Home48x48.png" alt="Home" title="Home" width="48" />
Now to add it to the new menu created:
Go to the new menu you created and paste your image source from the last step into the custom menu label (if the menu items are already added it will say navigation label) where the field that has URL is where you'll add the actual link to your page.