Hot answers tagged

2

You're comparing strings. For dates this will only ever work out if you use a yyyymmdd format or similar.


1

You could always try to create 2 arrays of titles, say $left and $right, $odd and $even, or $tom and $jerry, and fill them with the titles during your loop, and print them after the loop has ended like so: Create array $left = $right = array(); Then unleash your loop <?php // The loop if ( $query->have_posts() ) : $row_start = 1; while ( $...


1

You need to get the title for each post ID in your array. The straightforward way is this: $procedure_title_list = array(); $procedure_list = get_post_meta($patient_story->ID, 'Procedure', false); foreach ( $procedure_list as $procedure ) { $procedure_title_list[] = get_the_title( $procedure ); } echo implode( ', ', $procedure_title_list );


1

Up-voting Andy's answer, you should be comparing integers to get this working. strtotime() can turn any string to the time integer, which will be compared later to tell the difference and how many seconds passed until now ( time() ). Something like follows: $expired = ( ( time() - strtotime(get_the_date('Y-m-d H:i:s')) ) / DAY_IN_SECONDS ) >= 5; if ( $...


1

If you are targeting class method you need to pass an array where first argument is class instance and second is method name as string. Your add_shortcode line should look like this: add_shortcode($this->short_code_name, array($this, 'do_frontend_shortcode'));


1

Forget about connecting to your database while WordPress is ready and connected by default. Go after wpdb class for DB-specific tasks. First, call the global $wpdb variable which is the db class, and then use few methods to query your specific custom table. Not sure about the table structure? describe it first: global $wpdb; $table = $wpdb->prefix . "...



Only top voted, non community-wiki answers of a minimum length are eligible