use single2.php if referring site is xyz.com (4 posts)

  1. gerald@WPcustoms
    Posted 5 years ago #

    Hi there folks,

    I ran into a difficult problem - maby somebody here got an idea how to solve that:

    the title describes it best. so basically I want wordpress to use a special single.php (i.e. single2.php) file if the surfer comes from one specific site.
    It must be possible somehow with htaccess rewrite rules but I have no idea how that would look like and how to tell wordpress to use single2.php if site xyz.com is referring.

    Would be great if someone could please help me out on this.
    Thanks a lot

  2. gerald@WPcustoms
    Posted 5 years ago #

    after some searching I came across this plugin:

    I got an option to specify the refering site there and the welcome text but I need to change the whole template file. Maby it's possible with a modification of this plugin?

  3. gerald@WPcustoms
    Posted 5 years ago #

    is it possible with the WP conditional tags?
    i.e. <?php if (is_home()) { ?>

    instead of "is_home" use something like "if referring site is xyz.com"
    or some php referral detection?

  4. gerald@WPcustoms
    Posted 5 years ago #

    yeah I got it working with this:

    <?php if (strstr($_SERVER['HTTP_REFERER'],"referring-site.com")) { ?>
    hello referring-site.com
    <?php } else {
    echo "Internal referrer";

Topic Closed

This topic has been closed to new replies.

About this Topic