💎 PREMIUM: Changeset/ - Full Gallery 2025

Changeset 1948389


Ignore:
Timestamp:
09/28/2018 05:38:03 AM (7 years ago)
Author:
kuroit
Message:

Custom post type support and bug fixes

Location:
advanced-admin-search/trunk
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • advanced-admin-search/trunk/README.md

    r1948008 r1948389  
    55Requires at least: 3.9
    66Tested up to: 4.9.8
    7 Stable tag: 4.9.8
     7Stable tag: 0.9.1
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    4949== Changelog ==
    5050
     51= 0.9.1 =
     52* Support for custom post types
     53* Bug fixes
    5154= 0.9 =
    5255* Hello WordPress!
  • advanced-admin-search/trunk/advanced-admin-search.php

    r1948008 r1948389  
    44   Plugin URI: https://www.kuroit.com/product/advanced-admin-search
    55   description: A WordPress plugin which adds extra searching feature into admin bar.
    6    Version: 0.9
     6   Version: 0.9.1
    77   Author: Kuroit
    88   Author URI: https://www.kuroit.com
     
    4444
    4545    $params = array(
    46       'ajaxurl' => admin_url('admin-ajax.php', 'https'),
     46      'ajaxurl' => admin_url('admin-ajax.php'),
    4747      'ajax_nonce' => wp_create_nonce('advanced_search_submit'),
    4848    );
     
    9292        if(!empty($post_search))
    9393        {
     94
     95            $post_types = get_post_types(array('public' => true));
     96            $post_types = array_values($post_types);
     97
    9498            // get the register user.
    9599            $users = get_users( array( 'search' => "*{$post_search}*", 'fields' => array( 'display_name', 'user_registered', 'id' ) ) );
     
    97101
    98102            foreach ( $users as $user ) {
    99                 $url = admin_url( 'user-edit.php?user_id='.$user->id, 'https' );
     103                $url = admin_url( 'user-edit.php?user_id='.$user->id );
    100104               
    101105                $getUser = get_userdata( $user->id );
     
    104108               
    105109                foreach ($role as $value) {
    106                     echo "<li class='search_rows'><a class='search_result' href='".$url."'><img class='image_thumb' src='".esc_url( get_avatar_url( $user->ID ) )."'>" . $user->display_name . "<p class='list_status'>". $value."</p><p class='list_type'>" . $user->user_registered . "</p></a></li>";
     110                    echo "<li class='search_rows'><a class='search_result' href='".$url."'><img class='image_thumb' src='".esc_url( get_avatar_url( $user->ID ) )."'>" . $user->display_name . "<p class='list_status'>" . $value . "</p><p class='list_type'>" . $user->user_registered . "</p></a></li>";
    107111                }
    108112            }
     
    115119                $posts = get_posts(
    116120                    array(
    117                         's' => $post_search,
    118                         'post_status' => array('publish', 'pending', 'draft', 'auto-draft', 'future', 'private', 'trash'),
    119                         'posts_per_page' => $postPerPage
     121                        's'                 => $post_search,
     122                        'post_status'       => array('publish', 'pending', 'draft', 'auto-draft', 'future', 'private', 'trash'),
     123                        'post_type'         => 'any',
     124                        'posts_per_page'    => $postPerPage
    120125                    )
    121126                );
     
    124129               
    125130                foreach ($posts as $post) {
    126                     $url = admin_url( 'post.php?post='.$post->ID.'&action=edit', 'https' );
     131                    $url = admin_url( 'post.php?post='.$post->ID.'&action=edit' );
    127132                    $post_type = $post->post_type;
    128133
     
    148153
    149154                foreach ($mediaPosts as $mediaPost) {
    150                     $url = admin_url( 'post.php?post='.$mediaPost->ID.'&action=edit', 'https' );
     155                    $url = admin_url( 'post.php?post='.$mediaPost->ID.'&action=edit' );
    151156                    $post_type = $mediaPost->post_type;
    152 
    153                     echo "<li class='search_rows'><a class='search_result' href='".$url."''><img class='image_thumb' src='".$mediaPost->guid."'>".$mediaPost->post_title."<p class='list_type'>".$mediaPost->post_date."</p></a></li>";
     157                    $image_url = wp_get_attachment_image_src($mediaPost->ID);
     158
     159                    echo "<li class='search_rows'><a class='search_result' href='".$url."''><img class='image_thumb' src='".$image_url[0]."'>".$mediaPost->post_title."<p class='list_type'>".$mediaPost->post_date."</p></a></li>";
    154160                }
    155161            }
Note: See TracChangeset for help on using the changeset viewer.