1

I have added the following code to display "Featured: yes/no":

<div class="event-package-content">
    Featured: <?php echo $product->get_event_listing_featured(); ?>
</div>

I would like to change it to display only the word "Featured" under the package if the package is featured instead of "yes/no".

Package screenshot:

Package screenshot

Packages (shows after filling in details)

Can anyone please help?

Thanks.

Ruvee
  • 8,611
  • 4
  • 18
  • 44
  • You are required to post a [mcve] here, **within your question**, and [not a link](https://meta.stackoverflow.com/a/254430/162698) to any other site. – Rob Aug 15 '21 at 10:01

1 Answers1

2

You could replace your code:

<div class="event-package-content">
    Featured: <?php echo $product->get_event_listing_featured(); ?>
</div>

With this:

<div class="event-package-content">
  <?php echo ($product->get_event_listing_featured() == "yes") ? "Featured": ""; ?>
</div>
Ruvee
  • 8,611
  • 4
  • 18
  • 44