Home Forums Fashionic WordPress Theme Related posts

This topic contains 5 replies, has 2 voices, and was last updated by  jcderuijter 3 years, 4 months ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #2073

    jcderuijter
    Participant

    Hi,
    You helped me very much with my first question. I have one more question that I cannot solve myself. I did manage to get something working, but there is still a bug.

    If you look at this website: http://www.reclamebureauzolder.nl/projecten/olivier/ and open one of the blocks, there are related posts under the text. The idea is that when I click one of those items, the current block closes, and the right block opens. I managed to add rel to the LI, and act=”zoom” to the link. However, it does close when I click on one of the items, and it opens the right item. But, it does not open the right item from it’s original block, but creates a new one. Also, it does not close when you click again on another block.

    I hope you can help me, if it take more time, please let me know, perhaps we can set some terms?

    Best,
    Corné

    #2078

    Johnny
    Participant

    hi, I think this can be done by add your related post image with click event to trigger this post click event in posts list, no need add ‘rel’ or ‘zoom’ attributes to it. try this method first, any problem please let me known.
    Best

    #2079

    jcderuijter
    Participant
    This reply has been marked as private.
    #2083

    Johnny
    Participant

    hi, please try add this code to related posts the a tag:
    onclick="jQuery('li[postid=123] a').trigger('click');return false;"
    ‘123’ should be replaced to postid var in script.
    Best

    #2084

    jcderuijter
    Participant

    Thanks, after some puzzling I found a way. I had trouble with the javascript in PHP. Here is the code I finally used in combination with the Related Posts plugin of WordPress. You can see it in action on the previous link.

    $post_id_related = $related_post->ID;

    $onclick = “jQuery”;
    $onclick .= “(‘li[postid=”;
    $onclick .= $post_id_related;
    $onclick .= “] a’).trigger(‘click’);return false;”;

    $img = wp_rp_get_post_thumbnail_img($related_post, $image_size);
    if ($img) {
    $output .= ‘‘ . $img . ‘‘;
    }

    #2085

    jcderuijter
    Participant

    Obviously, it was not complete yet:

    img = wp_rp_get_post_thumbnail_img($related_post, $image_size);
    if ($img) {
    $output .= ‘‘ . $img . ‘‘;
    }

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.