View Single Post
  #1  
Old June 19th, 2012, 09:28 AM
Eric's Avatar
Eric Eric is offline
Datafeedr Team
 
Join Date: Feb 2008
Posts: 16,902
Default Store page conditional functions to use in your theme's PHP template files.

We've added a few new functions to determine what page of the store you are on if you are editing your theme's PHP template files.

Here are the basics:

is_dfr() - returns true if we're on a Datafeedr page
is_dfr('home') - returns true if we're on the store's front page
is_dfr('category') - returns true if we're on a store category page
is_dfr('product') - returns true if we're on a store product details page

Here are some basic usages that you could use in your theme's templates (a basic understanding of PHP is required):

Show something if we're viewing any page within the store:

PHP Code:
<?php if (is_dfr()) : ?>
    We're on a store page.
<?php endif; ?>
Show something only if we're on a product details page:

PHP Code:
<?php if (is_dfr('product')) : ?>
    You're viewing a single product in the store.
<?php endif; ?>
Show something if we're viewing a category page, show alternative message if we're not:

PHP Code:
<?php if (is_dfr('category')) : ?>
    You're viewing a category page in the store.
<?php else : ?>
    You're NOT viewing a category page in the store.
<?php endif; ?>
Eric