WordPress.org

Ready to get started?Download WordPress

Forums

WordPress Pastebin
[resolved] Recent Pastes is broken - fix attached (1 post)

  1. flexiondotorg
    Member
    Posted 3 years ago #

    Hi,

    I noticed the Recent Paste widget isn't working. Here is the simple fix.

    In function loop(); on line 74 the 'WP_Query' array define the 'post_type' to be 'paste' but it should actually be 'nk_paste'.

    Here is the complete function with the fix applied.

    function loop( $number = 5) {
      $my_query = new WP_Query( array(
        'post_type'             => 'nk_paste',
        'post_status'           => 'publish',
        'posts_per_page'        => $number,
        'suppress_filters'      => true
      ) );
      if ( $my_query->have_posts() ) {
        echo '<ul class="loop">';
          while ( $my_query->have_posts() ) {
            $my_query->the_post();
            echo '<li><a href="' . get_permalink( get_the_ID() ) . '">';
            the_title();
            echo '</a></li>';
          }
        echo '</ul>';
      }
      else {
        _e( 'No pastes found', 'wordpress-pastebin' );
      }
    }

    Regards, Martin.

    http://wordpress.org/extend/plugins/wordpress-pastebin/

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic