Tag Info

New answers tagged

-1

Found a method! echo '<META HTTP-EQUIV="REFRESH" CONTENT="3">' ;


1

I just made it for a client, you'll have to do it on the pre_get_posts action. That means you will add parameters to the Wordpress query before it returns the posts. Add this to functions.php: // advanced search functionality function advanced_search_query($query) { if($query->is_search()) { // category terms search. if ...


0

I have found a great tutorial here that have helped me to developing a custom user search. This is my solution: <?php /* Plugin Name: Simple User Listing Description: Create a simple shortcode to list our WordPress users. Author: Damiano Fossa Version: 1.6.3 */ function sul_user_listing($atts, $content = null) { global $post; global $wpdb; ...


2

This same exact question was asked earlier this week or over the weekend, and it had me thinking. Here is the idea that I came up with. If you look at the source code of the WP_Query class, you will see that sticky posts is only added to the first page of the home page. There is also no filter supplied to change this behavior in order to set the required ...


0

WP_Query is your answer for the first question, you will need to create a custom search form, and parse that data, in order to create your custom WP_Query. Here is a link with a tutorial to get you in the right direction. For the PDF part, I beleive it will be easier to tell the users to use Chrome and use the Print to PDF function, and create an stylesheet ...


1

If I understand you correctly you're not looking for the wp_search_stopwords filter type of solution. So here's a modification of the great answer by @kaiser that you referred to: /** * Exclude array of words from all search queries in the front-end * * Modification of http://wordpress.stackexchange.com/a/41100/26350 by @kaiser */ add_filter( ...


0

try this to exclude images from search. Add code to your functions.php: // Exclude images from search results - WordPress add_action( 'init', 'exclude_images_from_search_results' ); function exclude_images_from_search_results() { global $wp_post_types; $wp_post_types['attachment']->exclude_from_search = true; }


0

Seems I have an answer - it was how the SQL statement was setup. $where .= " OR (( $wpdb->postmeta.meta_key = '$meta_key' AND (UPPER($wpdb->postmeta.meta_value) LIKE '%$meta_value%') ))"; Now is the field has the string "Whistler Bike Park, Canada" but the user only searches for "Whistler", I get the post/s returned that I expect.


1

Easiest and most robust way is to add a url parameter to the search so the search url will be something like http://www.example.com/?s=xyz&from404=1. Probably easiest way to do that is by adding a hidden field to the form. For "bonus points" use the browser's history API to remove the parameter after the page load.


1

You can try and use set_query_var() very very early, before the query is parsed and queried for, for example during the pre_get_posts action. Although thinking about it, if you're using pre_get_posts it's likely easier to do something like this (off the top of my head): add_action( 'pre_get_posts', function( $query ) { if ( ! $query->is_main_query() ...


0

You can run the same loop multiple times by using rewind_posts() to output each type separately. if( have_posts() ){ $types = array('post', 'lesson', 'series'); foreach( $types as $type ){ echo 'your container opens here for ' . $type; while( have_posts() ){ the_post(); if( $type == get_post_type() ){ ...


1

There is not "blog" folder in WordPress and the search is not done in folders, it is done in the database. I assume you mean limit the search to standard post types. You could add post_type argument to the search form to include only the standard post type: <form method="get" class="searchform" action="<?php echo esc_url(home_url()); ?>/"> ...



Top 50 recent answers are included