New answers tagged

0

Use the get_search_form filter: add_filter('wp_nav_menu_items','add_search_box_to_menu', 10, 2); function add_search_box_to_menu( $items, $args ) { if( $args->theme_location == 'primary' ) return $items. get_search_form(); return $items; } add_filter( 'get_search_form', 'custom_search_form' ); function custom_search_form( $form ) { ...


1

REWORKED ANSWER TO ANSWER THE QUESTION In order to exclude all pages with a certain template, all you need to do is to run a meta_query to exclude all pages with the custom field _wp_page_template set to bedankt. Remember, WordPress saves the template assigned to a page as a hidden custom field called _wp_page_template With this in mind, we can do the ...


1

As discussed in the comments, your database prefix settings are off-kilter. Check the database prefix actually in use in your database, and make sure it's the same as the one in wp-config.php. Also make sure all of your WordPress-related tables have the same prefix. You'll also need to search through your database, particularly in the _options table, as ...


0

Woah there. You've just opened up a can of SQL injection. I use the default get_query_var('s') that I believe is automatically escaped by wordpress. Not quite - get_search_query() will do that, but get_query_var( 's' ) gets the "raw" value. Regardless, always use wpdb::prepare or similar escaping before executing SQL: $query = $wpdb->prepare( "...


0

It seems that this was simply a matter of waiting: the less trafficked pages updated their addresses quickly and the more trafficked pages (e.g., the home page) took longer to be update in Google search results. Other users with more heavily trafficked sites might wish to refer to this article on demoting site links to achieve results more quickly, but, for ...


0

You can create a new page. Let's say you want to have: http://example.com/mysearch/ Create a page that will have that URL structure. Next, Search form -> Go to and on you search form action do: <form role="filter-search" method="get" id="sd_searchform_filter" action="<?php echo home_url( '/mysearch/' ); ?>">... Now go to functions.php (...


1

You could try unsetting the original search query, otherwise you may be doubling up and the combination results in nothing? eg, try adding to your function: $query->set('s',''); UPDATE I am not sure on this one, but you could try the AND operator -I think this adds to the existing query instead of replacing it... function mytheme_pre_get_posts( $...


1

I've read through your post in it's entirety, I certainly don't see anything particularly wrong with it, but it sounds to me like your more frustrated with how it's been laid out. I personally have a big objected oriented programming background, it allows me to establish a structure and makes my code much more re-usable. My suggestion to you would be to ...



Top 50 recent answers are included