Datafeedr Support Forums

Datafeedr Support Forums (http://www.datafeedr.com/forums/index.php)
-   Tips, Tricks & Tutorials (http://www.datafeedr.com/forums/forumdisplay.php?f=66)
-   -   Store page conditional functions to use in your theme's PHP template files. (http://www.datafeedr.com/forums/showthread.php?t=7147)

Eric June 19th, 2012 09:28 AM

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


All times are GMT -5. The time now is 04:37 PM.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.