Wordpress HTML Question

by 16 replies
18
On my site VPS-Review.net ... see when you click the images? It brings up the image in a fancy display-like thing? I want it to direct to the post instead.

I believe this is the HTML:

<div class="preload_image">
<a class="single_image" href="<?php $links=wp_get_attachment_image_src( get_post_thumbnail_id($post->ID),full); echo $links[0]; ?>"><img src="<?php print_thumbnail_src('280','180') ?>" alt="single_review" /></a>
</div><!--end preload-->
<h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>

What would I need to do to make it direct to the appropriate post instead of the image-thing?

Thank you!!
#website design #html #question #wordpress
  • Click on the image in your post/page editor and click the edit icon that appears on top of the image. You'll see a box that says "Link URL". Type the URL you want the image to link to in that box and save.
  • Try this:

    HTML Code:
    <div class="preload_image">
    <a class="single_image" href="<?php the_permalink(); ?>"><img src="<?php print_thumbnail_src('280','180') ?>" alt="single_review" /></a>
    </div><!--end preload-->
    <h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
  • Luke, didn't quite have luck with that. It just made the popup bring up the entire post.

    Chriscobb, think it's more of a backend sort of thing so every image leads to the post, not just the individual pic.
  • Try removing the class of "preload_image" or change it to another class.
  • Would removing that alone make it go from bringing the pic up to making it go to the post though?
  • Sorry for not being clear. Try Luke's code and change/remove the class. You might have to add some CSS on the changed class. Just to make it look like the image before.

    Code:
     <!-- changed class-->
  • You're speaking a foreign language to me - haha.

    Is there anything I can provide to make the answer more clear-cut... like copy/pasting some HTML from elsewhere for you?
    • [1] reply
    • I would try to copy and paste what zaf101 posted.
  • But in the space where it says <---changed class---> what would I place there?
  • Preloading images means the image is loaded even before it is requested by the user. It is a technique used often to load large images so that they are ready when user checks it out. It is not responsible for the pop-up windows. Some other code or plugin is responsible for this.


    By the way, you are using a theme which isn't very good with SEO. Alt="single_review"??? Are you trying to rank for "single review"?
  • This was my first thought too. Did you try this? I'm not familiar with this theme, but by default WordPress points new images to a dedicated attachment page and not the post. Try going back to your posts and change the link settings for the images to the "Link to Post" option before you start banging your head against the wall screwing around with code.
  • Hm yeah I didn't do the single_review... that was like that. As for trying it manually, ah, I thought that would do it! Was excited, never saw that "post URL" button... but did it and nothing changed Very strange...
    • [1] reply
    • I know the poor SEO image alt tags is due to the theme. Most of these Internet marketers offer themes that are bloated with codes and have poor SEO. I had created a website review theme a few months back for a client. That guy's original theme was very buggy and poorly coded.
      • [1] reply
  • @xtrapunch
    Yeah you're right, I didn't find out when I checked out the site. The reason why I removed the class preload_image because, I usually use the preloaded images to load the fancybox/lightbox popup.

    @resellcells

    The <!--changed class--> is just a comment in HTML it won't do anything to the codes.
    Copy and paste the code below:

    Code:
    preload_image
    I just removed the class="single_image" because it loads the popup. You can check out the custom.js.
  • Zaf, perfect. Code works perfectly! Thanks so much everyone for helping!

Next Topics on Trending Feed

  • 18

    On my site VPS-Review.net ... see when you click the images? It brings up the image in a fancy display-like thing? I want it to direct to the post instead. I believe this is the HTML: