Template tag reference

These template tags can be used in your theme.

Note: because these tags belong to a plugin, they may become “undefined” if you disable the Great Real Estate plugin. To avoid errors, you may want to wrap any blocks of code that depend on the plugin being enabled.

if ( function_exists( get_listing_status ) ) {
    getandsetup_listingdata();
    // more code ...
}

Conditional tags

These tags return a logical true or false to help your code make decisions.

is_listing() - true if current page is a listing

is_listing_index() - true if current page is the listing index page

get_listing_hasclosed() - true if property sold or rented

Loop control functions

When using the WordPress Loop to display your page content, you will need to define $listing as a global (if inside a function), and then call a function at the start of each loop to set up your property listing data; after that, all you’ll need is the template tags.

Sample simple loop:

<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    <div class="post" id="post-<?php the_ID(); ?>">
        <h2><?php the_title(); ?></h2>
        <div class="entry">
            <?php if (function_exists('get_listing_status')) { ?>
                <?php getandsetup_listingdata(); ?>
                <h3><?php the_listing_status(); ?>
                <?php if (get_listing_hasclosed()) { ?>
                    <?php the_listing_saledate(); ?> for <?php the_listing_saleprice(); ?>
                        - last offered<?php } else { ?>- Offered<?php } ?>  at <?php the_listing_listprice(); ?></h3>
                <?php } ?>
            <?php } ?>
        </div>
    </div>
<?php endwhile; endif; ?>

getandsetup_listingdata() - sets up the listing data associated with the current page (assuming the page is also a listing)

Should you write your own SQL query, or use one of these predefined functions, you’ll be creating your own loop on each row returned by the query.

setup_listingdata( row )

Predefined queries

get_pages_with_active_listings( maxnum, sort )

get_pages_with_pending_listings( maxnum, sort )

get_pages_with_sold_listings( maxnum, sort )

get_pages_with_featured_listings( maxnum, sort ) - returns listings flagged as Featured

get_pages_with_listings( maxnum, sort, filter ) - filter can be one of “allsales”, “allrentals”, “active”, “pending”, “sold”, “featured”, or “none”.

Inside the loop

These tags return page attributes or content

get_listing_status()

the_listing_status()

get_listing_thumbnail()

the_listing_thumbnail()

get_listing_address()

the_listing_address()

get_listing_city()

the_listing_city()

get_listing_state()

the_listing_state()

get_listing_postcode()

the_listing_postcode()

get_listing_mlsid()

the_listing_mlsid()

get_listing_blurb()

the_listing_blurb()

get_listing_listprice()

the_listing_listprice()

get_listing_saleprice()

the_listing_saleprice()

get_listing_listdate()

the_listing_listdate()

get_listing_saledate()

the_listing_saledate()

get_listing_latitude()

get_listing_longitude()

get_listing_bedrooms()

the_listing_bedrooms()

get_listing_bathrooms()

the_listing_bathrooms()

get_listing_halfbaths()

the_listing_halfbaths()

get_listing_garage()

the_listing_garage()

get_listing_acsf()

get_listing_acsf_noformat() [since 1.1.1]

the_listing_acsf()

get_listing_totsf()

get_listing_totsf_noformat() [since 1.1.1]

the_listing_totsf()

get_listing_acres()

get_listing_acres_noformat() [since 1.1.1]

the_listing_acres()

Features

These tags will likely be deprecated in a future release in favor of a more flexible features manager.

get_listing_featureid()

get_listing_haspool()

get_listing_haswater()

get_listing_hasgolf()

get_listing_hascondo()

get_listing_hastownhome()

Tabbed interface content functions

These are used to generate the tabs and panels. Note that no output is generated if the required content is not present or the associated plugins are not activated.

Content above the tabs:

get_listing_description_beforemore()

the_listing_description_beforemore()

Tabs:

the_listing_map_tab()

the_listing_description_tab()

the_listing_gallery_tab()

the_listing_video_tab()

the_listing_panorama_tab()

the_listing_downloads_tab()

Panels:

the_listing_map_content()

the_listing_description_content()

the_listing_gallery_content()

the_listing_video_content()

the_listing_panorama_content()

the_listing_downloads_content()

Integrated functions

These functions could be used to supply argumenst to third party plugins

get_listing_galleryid()

get_listing_videoid()

get_listing_downloadid()

get_listing_panoid()

Sidebar functions

show_listings_featured() - see documentation on the Featured Homes widget