New answers tagged

0

After some tweaking I've discovered that I've totally forgotten the relation into meta_query. so I've just added 'meta_query' => array( 'relation' => 'AND', $closed, $ends, $budgets, ), and it worked fine.


1

Pieter's answer does work, but it displays all sticky posts even on pages when we want to display filtered posts (to a given category for instance). The following works for me. Adding this to functions.php only displays stickies within the subset of filtered posts : add_filter('the_posts', 'bump_sticky_posts_to_top'); function ...


0

is this a localhost install of wordpress? i had this problem with a localhost install, and it ended up being read/write permission issues between my /var/html/ folder and WP itself, and then it was read/write issues with the database :/ after working on it for a long time, i finally gave up and followed a different tutorial for installing LAMP/WP in one ...


0

I think, I found a solution by gmazapp. At least, it worked for me. It's a little hacky-ish, but does the job pretty good, so I'm sharing it, if someone will be looking for the same thing in the future.


-2

if ( have_posts() ) : ?> <header class="page-header"> <h1 class="page-title"><?php printf( __( 'Search Results for: %s', 'twentyfifteen' ), get_search_query() ); ?></h1> </header><!-- .page-header --> <?php // Start the loop. while ( have_posts() ) : the_post(); ...


1

The wp_get_attachment_image_src() function expects you to also pass some kind of attachment ID plus it doesn't grab the image HTML that we need so instead we should use wp_get_attachment_image(). IF a post has a post thumbnail, grab it.ELSE IF the post has any attached images, grab the first one.ELSE maybe show a placeholder? I've defined the else case at ...


0

I started this in a comment but thought I'd expand it for you because I do like the question ;) I'd probably tackle this by adding a hidden field to the search form with the current page ID, and then using the pre_get_posts filter to modify the search query to only return pages with a matching parent. However: I don't think we can deal with an additional ...


2

Just few simple ideas: A) Here's one suggestion using the get_search_form filter with a static variable to handle the instance counting: add_filter( 'get_search_form', function( $form ) { static $instance = 0; $instance++; // Setup your form here with the $instance variable as needed: $form = '<form>...</form>'; return ...


0

This isn't really a wordpress specific question, but you'll have to start by adding the classes you have in your search form to the Google code, until you get the results you desire. Without seeing all of your backend, it's hard to say what you need to do exactly, but this should get you on the right track. You probably don't need the my-nav-menu-search ...


1

Within the wp_get_document_title() function we have: // If it's a search, use a dynamic search results title. } elseif ( is_search() ) { /* translators: %s: search phrase */ $title['title'] = sprintf( __( 'Search Results for &#8220;%s&#8221;' ), get_search_query() ); so you could hook into the ...


0

Just like @cjbj says, use home_url() without the slash. home_url( $path, $scheme ); - $path (string) (optional) Path relative to the home URL. instead of home_url() you can use bloginfo('url') to get the root/home of your wordpress site.


-1

Not sure what actually happens, but if you use home_url() in stead of home_url('/') you should be fine


0

I looked into doing the same thing and in the end opted for a custom solution using thickbox as being less complex. Could be it's possible, but perhaps not worth the effort. The code is certainly not built for customisation as far as I could see. Open a thickbox modal with a search field Ajax search the post title with the user-entered search term Echo the ...



Top 50 recent answers are included