• Resolved j09

    (@j09)


    Greetings,

    In the Single listing page

    <?php the_acadp_address( $post_meta, $location->term_id ); ?>

    is used to output the following html:

    <p class="acadp-address">
      <span class="acadp-street-address">
        Street address
      </span>
      <span class="acadp-locality">
        <a href="/sub-sub-locality-link">sub-sub-locality name</a>
      </span>
      <span class="acadp-delimiter">,</span>
      <span class="acadp-locality">
      <a href="/sub-locality-link">sub-locality name</a>
      </span>
      <span class="acadp-delimiter">,</span>
      <span class="acadp-locality">
      <a href="/locality-link">locality name</a>
      </span>
      <span class="acadp-delimiter">,</span>
      <span class="acadp-country-name">
      <a href="/country-link">country name</a>
      </span>
      <span class="acadp-phone"><span class="glyphicon glyphicon glyphicon-earphone"></span>+12345678</span>
    </p>

    Which then is rendered like so:

    Street address
    sub-sub-locality, sub-locality, locality, country name
    +12345678

    I would like to display this information for each listing in the grid display.

    I am specifically interested in displaying:

    sub-sub-locality, sub-locality, locality, country name

    Instead of only displaying:

    sub-sub-locality

    by itself which is the default behavior.

    In other words, I would like to list the hierarchical terms for the location taxonomy that a listing falls under in the listings page.

    I tried adding:

    <?php the_acadp_address( $post_meta, $location->term_id ); ?>

    to the listings page and it works but only shows the street address and phone number.

    I hope that’s clear enough.

    Thank you.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author pluginsware

    (@pluginsware)

    1. Copy “the_acadp_address” function to your theme’s functions.php
    2. Rename it something like, “the_acadp_address_custom”
    3. Remove unwanted parts of the code like “Street Address”, “Phone Number”, etc..
    4. Then, use the following code in the listings page templates,

    <?php
    if( $location = wp_get_object_terms( $post->ID, 'acadp_locations' ) ) {
        the_acadp_address_custom( $post_meta, $location[0]->term_id );
    }
    ?>

    Hope, this helps!

    • This reply was modified 7 years, 4 months ago by pluginsware.
    Thread Starter j09

    (@j09)

    That worked like magic. Thank you very much!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Display Hierarchical Location in Listings Page’ is closed to new replies.