Problem display

Enclose the while loop with a conditional: $the_query = new WP_Query( array( ‘p’ => $id_film) ); if ( $the_query->have_posts() ) { while ( $the_query->have_posts() ): $the_query->the_post(); // regular output endwhile; wp_reset_postdata(); } else { echo ‘No movie data’; }

How to display search query as formatted text?

You’ll probably want filter out some parameters, change the order they’re displayed, etc – but this should get you started: $s = “/?s=Search&property_city=las-vegas&property_location=Nevada&min_price=20000&max_price=500000&beds=2&baths=3&min_area=1000&max_area=1000000&property_type=apartment&s=Search&apor=Any&apvr=Any&post_type=property”; parse_str($s,$parts); foreach ($parts as $key => $value) { $name = ucwords(str_replace(“_”,” “,$key)); echo “$name: $value<br />\n”; } You can probably just use foreach ($_REQUEST as $key => $value) { unless there’s a … Read more

Grouped Custom Meta Fields without plugin

stick with cmb2 — there is another method of displaying and then saving meta data, but it’s a PAIN and loads your functions file. the plugin pretty much has no effect on the front end of the site — it’ll also make your meta boxes a lot cleaner and consistent-looking

Assign class to Drop Down Selections in WooCommerce Products Custom Fields

You can do in the following way! Create an array of CSS class names and message values $colors_stings = array( ‘Message one’ => ‘message_color_green’, ‘Message two’ => ‘message_color_red’, ‘Message three’ => ‘message_color_blue’ ); Check if message string exist in array then assign CSS color class to variable. $css_class = isset($colors_stings[$product_status]) ? $colors_stings[$product_status] : ‘message_default_color’; Complete … Read more

Shortcode not picking up custom field

could be a question of string concatenation – try (untested): <a href=”‘.get_permalink().'” title=”‘.get_the_title().'”><img src=”‘. get_bloginfo(‘template_directory’).’/timthumb.php?src=”.$thumb.”&h=100&w=600&zc=1&q=100&a=”.get_post_meta($post->ID, “thumbcrop’, true).'” alt=”‘.get_the_title().'” /></a>