php – WordPress template file if else issue

Question

I’m trying to show information on a template page I made in WordPress. I am trying to show posts with GPS data if they don’t have a tag that says no-gps. I want to check which pages are missing the GPS data. Is there an easy way to do that? I’m thinking of using an if else statement to add a mark so that I can do a search for the pages in WordPress and manually add the missing GPS data. Any ideas are greatly appreciated though. How do I put the extra if else statement into the current if statement? Here’s my code:

<?php if(!has_tag('no-gps')){
//the_tags();
echo '<span id="topgps"><strong>GPS</strong>: '; 
the_field("GPS");
echo '</span>';
} ?>

I want to write:

If there is a page that doesn’t have the no-gps tag, with GPS data, show the value. This works now.

New bit: But if the GPS value is missing (no value at all) on a page that doesn’t have the no-gps tag show a star ★ instead.

0
Glen Charles Rowell 6 months 2022-02-23T02:45:36-05:00 0 Answers 0 views 0

Leave an answer

Browse
Browse