Changeset 12050 for sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/autocomplete.php
- Timestamp:
- 09/05/2022 05:14:31 AM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/autocomplete.php
r6301 r12050 43 43 wp_enqueue_script( 'awesomplete' ); 44 44 45 wp_register_script( 'autocomplete', get_ template_directory_uri() . '/js/autocomplete.js', array( 'awesomplete' ), '20160524', true );45 wp_register_script( 'autocomplete', get_stylesheet_directory_uri() . '/js/autocomplete.js', array( 'awesomplete' ), filemtime( dirname( __DIR__ ) . '/js/autocomplete.js' ), true ); 46 46 wp_localize_script( 'autocomplete', 'autocomplete', array( 47 47 'ajaxurl' => admin_url( 'admin-ajax.php' ), … … 100 100 'search_orderby_title' => 1, 101 101 'order' => 'ASC', 102 '_autocomplete_search' => true, 102 103 ); 103 104 104 105 $search = get_posts( $args ); 105 106 106 if ( !empty( $search ) ) { 107 $titles = wp_list_pluck( $search, 'post_title' ); 108 $form_data['posts'] = array_values( array_unique( $titles ) ); 107 if ( ! empty( $search ) ) { 108 $post_types_function_like = array( 'wp-parser-function', 'wp-parser-method' ); 109 110 foreach ( $search as $post ) { 111 $permalink = get_permalink( $post->ID ); 112 $title = $post->post_title; 113 114 if ( in_array( $post->post_type, $post_types_function_like ) ) { 115 $title .= '()'; 116 } 117 118 if ( $post->post_type == 'wp-parser-class' ) { 119 $title = 'class ' . $title . ' {}'; 120 } 121 122 $form_data['posts'][ $title ] = $permalink; 123 } 109 124 } 110 125
Note: See TracChangeset
for help on using the changeset viewer.