remove duplicates from recent

hi,

how i can avoid to display same post in Recent Post Widget as current post page?

thanks


Comments

  • Hi,

    please show us on screenshot what you mean exactly because we are not sure how you want to remove posts exactly.
  • http://marketignews.com/unmanned-aerial-vehicles-first-responders-technology-markets-forecast/

    take a look on this page, for example

    on right side you'll see your widget for related reports.... it sows here same report as posted.

    i do not want to show in this list the current report.
  • This is "Recent posts" widget as we see. We do not have unfortunately option to do not display current post because wordpress is not able to recognize where you are exactly because for wp posts are just posts. But of course, while future updates we'll check if there is anything what we can do in this case.

    Thanks for understanding!
  • guys. i hate 2 things: 
    1. to hear that something is undoable
    2. because they do not have it, we can not to include it too..... 

    GUYS! Your theme is awesome! and you should be cool programmers!!!! so just be ;-)



    this why i will give you this code, because i managed it by myself:

    open the widget-recent-post.php and add these 2 lines (i marked them for you):

    /* ---------------------------------------------------------------------------
    * Outputs the HTML for this widget.
    * --------------------------------------------------------------------------- */
    function widget( $args, $instance ) {

    if ( ! isset( $args['widget_id'] ) ) $args['widget_id'] = null;
    extract( $args, EXTR_SKIP );

    echo $before_widget;
    $currentID = get_the_ID();
    $title = apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base);
    if( $title ) echo $before_title . $title . $after_title;
    $args = array(
    'posts_per_page' => $instance['count'] ? intval($instance['count']) : 0,
    'no_found_rows' => true,
    'post_status' => 'publish',
    'ignore_sticky_posts' => true,
    'post__not_in' => array($currentID)
    );
    if( $instance['category'] ) $args['category_name'] = $instance['category'];



    enjoy
  • If you know coding then almost everything is possible. We meant that it is not possible with current version and included options. And because we do not offer code customizations, we can not modify files for your needs. That's why we notice all suggestions on our board and we do them while updates in the future.

    But thank you for this part of code. Maybe this will be useful for other users as well.
Sign In or Register to comment.