Theming Exchange - Checking if on an Exchange Page

When developing a theme or an add-on, it is not unusual to want to know what iThemes Exchange page you are on or if you are on one at all.

Most of our API functions related to pages are found in /api/pages.php

As of 1.6.1, if you want to check to see if you're on any Exchange page, you can use the it_exchange_is_page() function without a parameter. It will return the page if you're on an Exchange page or false if you are not.

Prior to 1.6.1, you'll have to ask WordPress for the it_exchange_view query_var

<?php $exchange_page = get_query_var( 'it_exchange_view' ); ?>

If you want to determine if you're on a specific page, you can use:

<?php if ( it_exchange_is_page( 'store' ) ); ?>

Other helpful functions include

<?php
it_exchange_get_page_type( 'store' ); // Returns exchange, wordpress, or disabled
it_exchange_get_page_slug( 'store' ); // Returns the query_var
it_exchange_get_page_wpid( 'store' ); // Returns the WordPress page_id if it is a 'wordpress' page type.
it_exchange_get_page_name( 'store' ); // Returns the setting for the page name or the WordPress page name if its a 'wordpress' page type
it_exchange_get_page_url( 'store' ); // Returns the permalink to the page.
?>

The first parameter in all of the above functions is the internal reference Exchagne has assigned to the page.
An optional second parameter can be set to true or false to break the options cache. This is necessary if page settings have just been saved.