Custom search with meta fields

I think that your main problem is that you are trying to display the results with searchform.php. That is basically just the form for the search, which you don’t need since you have your own form in the sidebar (if I understand you correctly). The results of a WP search are displayed with “search.php“

Display posts where date field matches current month?

You can use the meta_query parameter to display all events for the current month like this: $start_date = date( ‘ym01’ ); $end_date = date( ‘ymt’ ); $meta_query = array( ‘key’ => ‘event_date’, ‘value’ => array( $start_date, $end_date ), ‘compare’ => ‘BETWEEN’, ‘type’ => ‘NUMERIC’ ); $args = array( ‘post_type’ => ‘hh_event’, ‘posts_per_page’ => -1, ‘orderby’ … Read more

Function to retrieve a picture if there is no picture is attached

Test the value before you use it: <?php if ( ! $img = get_field(‘img_actor’, get_the_ID() ) ) $img = ‘http://www.example.com/wp-content/uploads/default.jpg’; ?> <img class=”film” src=”https://wordpress.stackexchange.com/scripts/timthumb.php?src=<?php echo urlencode($img); ?>&h=251&w=175&zc=1″ alt=”<?php the_title_attribute(); ?>” title=”<?php the_title_attribute(); ?>”/> I recommend not to use the same text for title and alt, this is very annoying for screen reader users.

loop through custom post-type with two meta_keys

You’ll need to use meta_query along with meta_(key|value|compare) to interact with two different keys and get the order you want. <?php $q = new WP_Query(array( ‘post_type’ => ‘my_project’, ‘nopaging’ => true, // same as posts_per_page => 1, ‘order’ => $order, ‘orderby’ => ‘is_featured_position’, // your position key here ‘meta_key’ => ‘is_featured_position’, // also here, see … Read more