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

Incorrect data after modifying post using backlink from wp_die

I don’t know why this issue occurs. The back_link is created in /wp-includes/functions.php. If there were a Javascript solution, it could be applied in the message of wp_die. For example: $msg = ‘Error’ . “\n<p><a href=”https://wordpress.stackexchange.com/questions/80375/javascript:history.go(-1)”>$back_text</a></p>”; wp_die($msg, ‘Error’, array( ‘response’ => 500 )); But this didn’t work… What I saw is that the Title and … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)