• Hi everybody,
    i need to solve this problem. I’d like to change the post image link in the blog index page, i’d like that the post images point direct to the post.

    This is the site: https://www.leotorri.com/wordpress/?page_id=1069

    And this is the part of the code i’d like to change:

    <!– Begin each blog post –>
    <div class=”post_wrapper”>

    <?php
    if(!empty($image_thumb))
    {
    $small_image_url = wp_get_attachment_image_src($image_id, ‘blog’, true);
    ?>

    <br class=”clear”/>
    <div class=”post_img”>
    <ahrf=”<?php echo $image_thumb[0]; ?>” class=”img_frame”>
    <img src=”<?php echo $small_image_url[0]; ?>” alt=”” class=””/>

    </div>

    <?php
    }
    ?>

    I’ve change the word ahref to make you read my post correctly.

    Thank you very much and regards

    Manuel

Viewing 15 replies - 1 through 15 (of 18 total)
  • use <a href="<?php the_permalink(); ?>">

    Thread Starter manolino11

    (@manolino11)

    Thank you very much, i’ve tried to do this

    <br class=”clear”/>
    <div class=”post_img”>
    <ahrf=”<?php the_permalink(); ?>”>
    <img src=”<?php echo $small_image_url[0]; ?>” alt=”” class=””/>

    But it doesn’t seems to work, the little hand of a link appears but when i click nothing happens.

    Can you tell me exactly where i must put the code you suggest me?

    Thank you very much

    looks like a problem with the loop.. do share the complete loop code for better understanding..
    also use backticks (left of ‘1’) to enclose code..

    Thread Starter manolino11

    (@manolino11)

    Thank you again… please can you tell me how can i share the complete loop code please? I’m not so fine with code…

    Thanks a lot

    Manuel

    this is your source code sample:

    <div class="post_wrapper">
        <br class="clear"/>
        <div class="post_img">
        	<a href="<link>">
    	<img src="..." alt="" class=""/>
            </a>
        </div>
        <div class="post_date">
        .....
        </div>
        <div class="post_header">
        	<h5 class="cufon"><a href="<link>">title</a></h5>
        	<div class="post_detail">
        	</div>
        </div>

    Copy the a href link of ‘post_header’ class to ‘post_img’ class and it should work…

    Thread Starter manolino11

    (@manolino11)

    The href of the post header is the same of the one that you’ve suggested me in the first post… it wont work! Now i’ve modified only the file blog.php, must i modify other files like single.php?

    Ok you are sharing ‘too much’! i suggest you remove it.. ??

    ok so like i said earlier, <a href="<?php the_permalink(); ?>"> will work! so..

    1. add the above to your code.

    2. looks like your scripts are creating an issue. for testing purpose, remove the following code from your files and try:

    <SCRIPT TYPE="text/javascript">
    <!--
    //Disable right click script
    //visit https://www.rainbow.arch.scriptmania.com/scripts/
    var message="Sorry, right-click has been disabled";
    ///////////////////////////////////
    function clickIE() {if (document.all) {(message);return false;}}
    function clickNS(e) {if
    (document.layers||(document.getElementById&&!document.all)) {
    if (e.which==2||e.which==3) {(message);return false;}}}
    if (document.layers)
    {document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;}
    else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;}
    document.oncontextmenu=new Function("return false")
    // -->
    </SCRIPT>

    Thread Starter manolino11

    (@manolino11)

    Thank you very much, i’m very sorry but i’m not able to find the scrtipt mentioned in your reply… i’ve looked for into the blog.php, function.php, single.php, but i can’t find it.

    May you know where is it?

    Excuse me for my bad knowledge of code.

    Manuel

    check header.php

    Thread Starter manolino11

    (@manolino11)

    I’ve erased that script but it doesn’t work anyway…

    argh! ?? did you do it on ‘live’ code? because i cant right-click on your site.. and thats what that script is supposed to do primarily..

    Thread Starter manolino11

    (@manolino11)

    No, ive erased the script but installed a plugin named no right click images. I’ve tried to click the post thumb image but it did’n work also without plugin installed. If you’d like to try without the plugin tell me and i will deactivate that.

    yessir..

    Thread Starter manolino11

    (@manolino11)

    Done!

    ok this is getting irritating! ??
    hope you noticed that if you right-click on the image and open link in new tab, it opens the post properly. so the problem is with ‘clicking’ the image now.
    before we go deeper into the code, can you disable all plugins and test once? and if it works, enable the plugins one-by-one and figure out which one is causing the issue?

Viewing 15 replies - 1 through 15 (of 18 total)
  • The topic ‘Changing the post thumbnail link onto blog index page’ is closed to new replies.