Before you ask please READ THIS

Related posts

edited December 2011 in Airlock Posts: 15
Can you explain me , please , what the rule for select related posts ?

Thank you

Comments

  • AirAir
    Posts: 10,970
    Related by category in our theme. Default WP Plugin works by tag.
  • Posts: 15
    How I can return selection by tag ?
  • AirAir
    Posts: 10,970
    Sorry there is no such thing as default WP plugin for related posts ;-)

    If you wish you can copy widget under new name, but here I will provide you info how to change current one.
    Go to airlock/advance/widgets.php delete 216-220 lines
    insert on their place:

    $tags = wp_get_post_tags($post->ID);
    $tagIDs = array();
    if ($tags) {
    $tagcount = count($tags);
    for ($i = 0; $i < $tagcount; $i++) {
    $tagIDs[$i] = $tags[$i]->term_id;
    }

    $r = new WP_Query(array('tag__in' => $tagIDs,'post__not_in' => array($post->ID), 'posts_per_page' => $number, 'no_found_rows' => true, 'post_status' => 'publish', 'ignore_sticky_posts' => true));


    Not tested but should work. Backup widgets files before modifications.

    With regards.
  • Posts: 15
    Great support !
    Works very well !

    Unspeakable!
  • AirAir
    Posts: 10,970
    Thanks for good words ;-)

    With regards.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!