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.
This website uses cookies

We use cookies to personalise content and ads, to provide social media features and to analyse our traffic. We also share information about your use of our site with our social media, advertising and analytics partners who may combine it with other information that you’ve provided to them or that they’ve collected from your use of their services.

Cookies are small text files that can be used by websites to make a user's experience more efficient.

The law states that we can store cookies on your device if they are strictly necessary for the operation of this site. For all other types of cookies we need your permission. This means that cookies which are categorized as necessary, are processed based on GDPR Art. 6 (1) (f). All other cookies, meaning those from the categories preferences and marketing, are processed based on GDPR Art. 6 (1) (a) GDPR.

This site uses different types of cookies. Some cookies are placed by third party services that appear on our pages.

You can at any time change or withdraw your consent from the Cookie Declaration on our website.

Learn more about who we are, how you can contact us and how we process personal data in our Privacy Policy.

Please state your consent ID and date when you contact us regarding your consent.