customize search result in wordpress

What shows in search results is not always controlled by search plugins. You probably need to adjust your theme. Create a child theme, copy search.php from the parent theme into the child theme, and wherever it calls for the_content() replace that with the_excerpt(). Some search plugins may modify this behavior, so you’ll have to do … Read more

WP Query – Search in title or author_name

EDIT : Sorry just read that you need a ‘OR’ in your query. I will update anwser soon. According to your question, you can try this code. // WP_Query arguments $args = array( ‘name’ => ‘test’, ‘author_name’ => ‘test’, ); // The Query $query = new WP_Query( $args ); // The Loop if ( $query->have_posts() … Read more

Add CPT to search results with pre_get_posts

I found a partial solution. When I add this part of code into my search form: <input type=”hidden” name=”post_type[]” value=”my_CPT_name” /> search results contains my CPT (even when ‘exclude_from_search’ is set to ‘true’). Now, I change my pagination code to this: <?php echo paginate_links( array( ‘total’ => $wp_query->max_num_pages, ‘prev_text’ => __(‘ « ‘), ‘next_text’ => … Read more

Create search box on Archive Custom post type

In your template_search_spec_needs.php, remove the custom query. The parameters in your url (s=&post_type=spec-needs-res) should work with the “normal” loop just fine. So try changing your template_search_spec_needs.php to something like this: <?php while ( have_posts() ) : the_post(); ?> <div class=”span4 spec-needs-list-single”> <div class=”spec-needs-title”><?php the_title(); ?></div> <div><?php the_excerpt(); ?></div> <div class=”plus-btn-spec-needs-cont”><a href=”https://wordpress.stackexchange.com/questions/299191/<?php the_permalink(); ?>”><button class=”plus-btn-spec-needs”>+</button></a></div> </div> … Read more

On WordPress Search, how to search post from Author meta also

You can start with prepare information what you need using MySQL SELECT * FROM `wp_usermeta` WHERE `meta_key` = “description” For example, you can create the file with the prepared output of your custom query and then use jQuery * Ajax for your search box.. I’ve show you sample of json file: <?php require_once(‘../../../wp-load.php’); $gm = … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)