Skip to content

PHP Customization - how to display number of properties in Taxonomy (Text Field)?

1 minute read

We will show how to display number of properties For Sale in the Offer Type as en example on the single property page

  1. 1 Visit Offer Type page and check a slug of the field (here: offer-type)
  2. 2 Hover For Sale to see its ID (here:117)
  3. 3 Now paste this PHP Code at the top of your /wp-content/themes/myhome/templates/single-estate-partials/content-single-estate.php file
php
<h1>Number of For Sale properties in the Offer Type:
    <?php
    $term = get_term( 117, 'offer-type' );
    echo $term->count;
    ?>
</h1>

File will look like this:

It will look like this on your single property page. Now you can style it via CSS and change ID (117) or SLUG (offer-type) for any other

Ask the people who build MyHome WPBakery

We answer by email from support@tangiblewp.com. With Premium Support, we also fix your site when something breaks.

Was this guide helpful?