Conditional sidebar menu

Bainternet’s solution will definitely work, but it you want to use the page slug instead of ID you could put this in your functions.php file: // GET PAGE ID FROM THE SLUG, HELPER FUNCTION FOR IS_TREE function get_ID_by_slug($page_slug) { $page = get_page_by_path($page_slug); if ($page) { return $page->ID; } else { return null; } } // … Read more

If statement to check for post_content

The following line is wrong <?php echo get_post_meta($partner->ID, $a_description, true); ?> If you look closely, you are actually passing get_post_meta($partner->ID, “a_description”) to the $key parameter of get_post_meta as this is the value assigned to $a_description You should most probably change $a_description to just a_description EDIT This line <?php echo get_post_meta($partner->ID, $a_description, true); ?> should most … Read more

How to display image on condition that a selection has been made

you can try this: if(get_field(‘activity_rating’) == “1”) { echo ‘path/to/image/onestar.jpg’; } elseif (get_field(‘activity_rating’) == “2”) { echo ‘path/to/image/twostar.jpg’; } elseif (get_field(‘activity_rating’) == “3”) { echo ‘path/to/image/threestar.jpg’; } elseif (get_field(‘activity_rating’) == “4”) { echo ‘path/to/image/fourstar.jpg’; } else (get_field(‘activity_rating’) == “5”) { echo ‘path/to/image/fivestar.jpg’; }

How to know if the most recent article

Sounds like WordPress does not support this out of the box. However, you can get the most recent post via wp_get_recent_posts(), and then check against the result from there. Here I am using array_shift() to turn the array containing one post into the post itself. $args = array( ‘numberposts’ => 1, ‘post_status’ => ‘publish’, ); … Read more