Content Restriction but allow public REST API

You can use the REST_REQUEST constant to detect if this is a REST request, and if it’s not, apply your filter(s). Example: add_filter( ‘the_content’, ‘wpse418531_use_excerpt’ ); /** * Replaces the content with the excerpt, unless this is a REST request. * * @param string $content The post content. * @return string The filtered post content. … Read more

How to tie two conditions to one statement

You can do this: $ac_inc = get_the_author_meta( ‘ac_inc’, $post->post_author ); if (has_tag(‘aria condizionata’, $post) && !empty($ac_inc)) { $ac_inc=”<div class=”ac_inc”>”. $ac_inc .'</div>’; } But actually the double “if” statement would be more optimal, as you would only run ‘get_the_author_meta’ when needed: if (has_tag(‘aria condizionata’, $post)) { $ac_inc = get_the_author_meta( ‘ac_inc’, $post->post_author ); if(!empty($ac_inc)){ $ac_inc=”<div class=”ac_inc”>”. $ac_inc … Read more

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’; }

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