I am having difficulty with a Wordpress site that has already been pretty heavily customized. Suddenly, one of the pages simply stopped working!
The issue is that when clicking a video link, a lightbox clone (prettyPhoto) is supposed to show the youtube video, but instead the popup message "Image cannot be loaded. Make sure the path is correct and image exist." displays.
Here is what I have learned so far on the issue through a lot of research and exploring the code:
The page is composed of individual posts and the images that the anchor tag is surrounding are generated using the video thumbnail of each post.
The posts themselves are merely a YouTube link "ex: http://www.youtube.com/watch?v=LdOKJ7cybi4" with a title and a video thumbnail.
The issue seems to be caused by the href attribute that Wordpress generates. Using the above youtube link example, it supplies a href attribute like this (it actually puts the span tags and everything inside of the href attribute):
<span class='embed-youtube' style='text-align:center; display: block;'>
<iframe class='youtube-player' type='text/html' width='640' height='390' src='http://www.youtube.com/embed/LdOKJ7cybi4?version=3&rel=1&fs=1&showsearch=0&showinfo=1&iv_load_policy=1&wmode=transparent' frameborder='0'></iframe>
</span>
When I remove the span tags and all contents and replace it with the content of the post (ex: http://www.youtube.com/watch?v=LdOKJ7cybi4), then it works! But, I can't figure out how to make it use the YouTube link that was typed into the post, rather than generating these excessive and unneccessary span tags.
Help please!
It seems like wordpress is formatting your text. there are several plugins available to stop this happening for eg :
http://wordpress.org/support/view/plugin-reviews/ps-disable-auto-formatting
However, given that your site is already highly customized I would recommend exercising caution and perhaps backing up first.
Related
I need to retreive image from an external link using php. I am not interested to use services like Embed.ly
I tried this one: https://www.webslake.com/article/generating-link-preview-using-php/
But it failed to get the image. Just showing the alt text.
Please help me to solve this problem...
Your code is looking for an og:image or twitter:image meta tag, and then (as a fallback) for large image tags.
Twitter.com has none of these if you view the source as a logged-out user. There's no image for your code to fetch, so it fails to do so. This won't be uncommon, so it'd be best to have a "if no image is found" fallback in your code.
Ok. So I have a wordpress plug-in that runs a cron job that reads RSS feeds, then parses the RSS feed title and excerpt into new posts.
Most of the time, each RSS 'post' that is read includes an img tag that is straight up html (ex: <img src="localhost/img/img-1.png">). That img is stored in a cache on my own wordpress server so it's visible without the need of the RSS server it was read from.
What I'm trying to do is to use the img tag src as the background-image for the post.
As of now, the only way I can see the image tag without loading the wordpress post, is by diving into the WPDB, finding the post and copying out the img src.
I've already tried using the post-thumbnails option, but since the image isn't loaded as a Featured Image when it's read from the RSS feed, the image isn't loaded into the Media library of the wordpress install.
My train of thought is leading me towards some way to parse the img tag src into it's own mysql table, but that is a whole bowl of noodles I'd rather avoid.
Is there an easier way to do this?
When the thumbnail is clicked I would like the full size image to open on http//example.com/image.aspx instead of http//example.com/images/image.jpeg without creating an individual page for each image and editing each href. I know that this is possible with php but I was wondering if there was some way of doing it with javascript, jquery, asp.net, or...? If it is possible, (I maybe stretching it here), would it also be possible to run this on the master page for all thumbs? The thumbs have no class or id. Right now they are in straight html markup. I have searched for days and have found nothing that would even get me started on the correct path with the exception of php. I don't need the target blank if I could implement this because this would allow me to open the image on a aspx content page with full site navigation. Here is the code as of right now.
<a target="_blank" href="image.jpg/jpeg"><img alt="something" src="pictures/image_small.jpg/jpeg"></a>
A page from our site is http://backalleypics.com/PeoplesPages/Sa~Se/SarahShahiPages/SarahShahi1.aspx. An example of the php type is http://www.theplace2.ru/photos/gallery.php?id=47 I really don't want a gallery, pop up window, or light box. The purpose is to get ad views for each image click and have navigation on the page.
You can use an existing library that do that, like the: http://highslide.com/
There are also many others, some of them:
http://www.dynamicdrive.com/dynamicindex4/thumbnail.htm
http://valums.com/javascript-image-galleries/
I'm using WordPress as my CMS and I just downloaded a Lightbox plugin for a photo gallery on one of my pages. It works exactly how I want it to, except for one thing.
After clicking on a thumbnail to get the photo enlarged with a lightbox effect, I want to be able to click on a link to take me to the main article where that picture is from.
I've tried a few ways but the issue which arises is that I can't pass < ?php the_permalink(); ?> through a JavaScript function. How would I go about to accomplish this?
Thanks to anyone who can help!
The only way to do it is have the image link go to some inline content, which contains the image wrapped in the this is the only way. The lightbox website will have examples of linking inline content, but for every image you will need to generate the inline content, this is the limitations of using a plugin.
If I were in your shoes, I would write a custom modal function, which would take the permalink from an attribute of the image (rel, title, class) and display the larger image linked to the permalink. I am sure you can find a custom modal tutorial, but basically you create a box in your css, which is set to display:none, then when your link(s) is/are clicked, you use jQuery to append one of the boxes to body, append your content into the box, then display it in the center of the screen, using absolute positioning, and opaque to dull everything else.
I have a page with some text and links. I want to display image there itself on clicking those links. However, I am bound of not using javascript at all. All I can use is some server side component like PHP.
Thanks
Since you stated in a comment that you don't want to reload the page and can't use Ajax, PHP won't help you because it runs on the server. Instead, you can achieve what you want with CSS. Have a look at this simple demo.
Basically, you put the image inside the link:
link text <img src="...">
and then specify in your CSS something like:
a img {display:none}
a:visited img {display:inline}
so the image is hidden by default, but once the user clicks on the link, the image is displayed. If you have several images on your page, you must assign each link a different href anchor:
link text <img src="...">
link text <img src="...">
One potential issue with this approach is that once a user has revealed a particular image, that image will also be revealed by default on that user's subsequent visits to that page unless he clears his browser history. If you want to prevent that from happening, i.e. always hide all images by default, then, for example, your PHP code could generate random href anchors each time.
This is entirely possible, but you have to tolerate the fact that when the user clicks on the link, the page will have to reload in order to show the image.
So, basically, your links will be something like this:
http://myserver/myscript.php?id=0
And then your PHP will include an IMG tag for the appropriate image, perhaps like this:
$id = $_GET['id'];
echo "<img src='/images/image_$id.jpg'>\n";
If you were able to use Javascript you could have it work without needing to reload the page, but apart from that, doing it with PHP should be fine.