Support » Plugins » [Plugin : YD Recent Posts Widget] Need Help with PHP

  • Resolved mr_erk

    (@mr_erk)


    I’m new to php and can’t figure this out.
    I already managed to increment values inside my code…What I need is also to decrement the $offset inside the loop…Can anyone help me with this? Here’s my code;

    <?php
    for ($id=1; $id<=19; $id++)
      {
      echo '<div id="content_' . $id . '"><div class="text"><h2>' . $id . '</h2>';
    rewind_posts();
    display_yd_previous_posts_here('posts_per_page=1' . '&offset=$offset');
    echo '</div></div>';
    }
    ?>

    Thanks in advance…

Viewing 1 replies (of 1 total)
  • resolved…

    <?php
    for ($id=1,$offset=-1; $id<=19,$offset>=-19; $id++,$offset--)
      {
      echo '<div id="content_' . $id . '" class="tab_view"><div class="text"><h2>' . $id . '</h2>';
    rewind_posts();
    $args = array(
    	'posts_per_page'      => 1,
    	'offset'     => $offset
    );
    display_yd_previous_posts_here($args);
    echo $offset;
    echo '</div></div>';
    }
    ?>

Viewing 1 replies (of 1 total)
  • The topic ‘[Plugin : YD Recent Posts Widget] Need Help with PHP’ is closed to new replies.