Advertisement
msaari

WP Table Reloaded fix

Nov 3rd, 2011
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.93 KB | None | 0 0
  1.         <tr valign="top">
  2.             <th scope="row"><?php _e( 'Last Modified', WP_TABLE_RELOADED_TEXTDOMAIN ); ?>:</th>
  3.             <td><?php echo $this->format_datetime( $table['last_modified'] ); ?> <?php _e( 'by', WP_TABLE_RELOADED_TEXTDOMAIN ); ?> <?php echo $this->get_last_editor( $table['last_editor_id'] ); ?></td>
  4.         </tr>
  5.         <tr valign="top">
  6.             <th scope="row">Appears in:</th>
  7.             <td><?php
  8. global $wpdb;
  9.  
  10. $query = "SELECT * FROM $wpdb->posts WHERE post_status = 'publish'";
  11. $results = $wpdb->get_results($query);
  12. $pattern = '/table id=["]?(\d+)/';
  13. foreach ($results as $post) {
  14.     $m = preg_match($pattern, $post->post_content, $matches);
  15.     if ($m) {
  16.         if ($matches[1] == $table['id']) {
  17.             $link = get_permalink($post->ID);
  18.             $edit = get_edit_post_link($post->ID);
  19.             echo "<a href='$link'>$post->post_title</a> (<a href='$edit'>edit</a>)<br />";
  20.         }
  21.     }
  22. }
  23.  
  24.             ?></td>
  25.         </tr>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement