Community @ The Turning Gate

Support community for TTG plugins and products.

NOTICE

The Turning Gate's Community has moved to a new home, at https://discourse.theturninggate.net.

This forum is now closed, and exists here as a read-only archive.

  • New user registrations are disabled.
  • Users cannot create new topics.
  • Users cannot reply to existing topics.

You are not logged in.

#1 2016-04-20 10:22:06

trummonte
Member
From: Buena Vista, Colorado
Registered: 2012-11-11
Posts: 178
Website

Help with targeting Home Page

I am trying to insert code into the head of just the home page. I can insert it just fine if I don't try to target a page, but otherwise it renders the site unavailable. Here is the code. I have tried adding and removing the return true and false statements.

// Popup Form on Home Page
function ttg_head_end( $style, $path ) {
    if (G_STYLE == 'CE4-PAGES-HOME') {
        echo '
            <meta name="viewport" content="width=device-width, initial-scale=1.0" />
            <link rel="stylesheet" href="./popup/colorbox/colorbox.css" />
            <script src="./popup/common/libs_js/jquery-1.4.4.min.js"></script>
            <script src="./popup/colorbox/jquery.colorbox.js"></script>
            <script>
                var $fb_pop = jQuery.noConflict();

                $fb_pop(document).ready(function(){
                    setTimeout( function(){ $fb_pop.colorbox({href:"./popup/popup.html", iframe:true, innerWidth:"432px", height:"80%", maxHeight:"435px", fixed:true}) }, 25000 );
                    $fb_pop(".fb_iframe").colorbox({iframe:true, innerWidth:"432px", height:"80%", maxHeight:"435px", fixed:true });
                });
            </script>
        ';
        return false;
    }
    return true;
} // END

Any ideas?

Thanks - Monte

Offline

#2 2016-04-20 10:44:41

rod barbee
Moderator
From: Port Ludlow, WA USA
Registered: 2012-09-24
Posts: 17,830
Website

Re: Help with targeting Home Page

Matt's example isn't using return. Have you tried removing any returns?
http://ce4.theturninggate.net/docs/doku … #ce4_pages


Rod 
Just a user with way too much time on his hands.
www.rodbarbee.com
ttg-tips.com, Backlight 2/3 test site

Offline

#3 2016-04-20 11:46:02

trummonte
Member
From: Buena Vista, Colorado
Registered: 2012-11-11
Posts: 178
Website

Re: Help with targeting Home Page

Hi Rod. I have tried it with all combinations, from none to both. The existing code for the ttg_head function I am already using for all pages doesn't don't have any and that is what I started out with.

Thanks - Monte

Offline

#4 2016-04-20 11:59:15

rod barbee
Moderator
From: Port Ludlow, WA USA
Registered: 2012-09-24
Posts: 17,830
Website

Re: Help with targeting Home Page

I don't know how much this matters, but here your calling jQuery 1.4.4:

<script src="./popup/common/libs_js/jquery-1.4.4.min.js"></script>

but ttg pages already call jQuery version 1.11.3. This may be creating a conflict.


Rod 
Just a user with way too much time on his hands.
www.rodbarbee.com
ttg-tips.com, Backlight 2/3 test site

Offline

#5 2016-04-20 12:03:16

trummonte
Member
From: Buena Vista, Colorado
Registered: 2012-11-11
Posts: 178
Website

Re: Help with targeting Home Page

I don't think it matters Rod. I pasted the same code into the ttg-head function I already had and it works. The issue is just getting it to load on the home page only.

Thanks!

Offline

#6 2016-04-20 13:32:33

rod barbee
Moderator
From: Port Ludlow, WA USA
Registered: 2012-09-24
Posts: 17,830
Website

Re: Help with targeting Home Page

are you already using ttg_head_end in another part of the phplugins file?
I believe you can only use each function once so if you have another (like for adding custom CSS) you'll probably need to use if/else conditional statements.


Rod 
Just a user with way too much time on his hands.
www.rodbarbee.com
ttg-tips.com, Backlight 2/3 test site

Offline

#7 2016-04-20 22:26:52

trummonte
Member
From: Buena Vista, Colorado
Registered: 2012-11-11
Posts: 178
Website

Re: Help with targeting Home Page

Hey Rod. Yes, there is another section with ttg_head, so I went ahead and tried the conditional statements. It doesn't lock up, but it never inserts the added code on the home page. Here is the new code (I have tried it with and without the return false statements):

function ttg_head_end( $style, $path ) {
      if (G_STYLE == 'CE4-PAGES-HOME') { // Popup Form on Home Page
        echo '
        <link rel="stylesheet" href="https://www.montetrumbull.com/phplugins/css/custom.css">
        <link href="https://fonts.googleapis.com/css?family=Marcellus" rel="stylesheet" type="text/css">
        <link href="https://fonts.googleapis.com/css?family=Marcellus+SC" rel="stylesheet" type="text/css">   
        <link rel="stylesheet" href="https://www.montetrumbull.com/phplugins/css/jquery.kyco.googleplusfeed2.css">
        <script src="https://www.montetrumbull.com/resources/js/jquery.kyco.googleplusfeed2.min.js"></script>
        <meta name="msvalidate.01" content="57C199CAA37B29A675E57F15450D64B1" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
            <link rel="stylesheet" href="./popup/colorbox/colorbox.css" />
            <script src="./popup/common/libs_js/jquery-1.4.4.min.js"></script>
            <script src="./popup/colorbox/jquery.colorbox.js"></script>
            <script>
                var $fb_pop = jQuery.noConflict();

                $fb_pop(document).ready(function(){
                    setTimeout( function(){ $fb_pop.colorbox({href:"./popup/popup.html", iframe:true, innerWidth:"432px", height:"80%", maxHeight:"435px", fixed:true}) }, 25000 );
                    $fb_pop(".fb_iframe").colorbox({iframe:true, innerWidth:"432px", height:"80%", maxHeight:"435px", fixed:true });
                });
            </script>
        ';
        return false;
    }
    else {
        echo '
        <link rel="stylesheet" href="https://www.montetrumbull.com/phplugins/css/custom.css">
        <link href="https://fonts.googleapis.com/css?family=Marcellus" rel="stylesheet" type="text/css">
        <link href="https://fonts.googleapis.com/css?family=Marcellus+SC" rel="stylesheet" type="text/css">   
        <link rel="stylesheet" href="https://www.montetrumbull.com/phplugins/css/jquery.kyco.googleplusfeed2.css">
        <script src="https://www.montetrumbull.com/resources/js/jquery.kyco.googleplusfeed2.min.js"></script>
        <meta name="msvalidate.01" content="57C199CAA37B29A675E57F15450D64B1" />
        ';
        return false;
    }
    return false;
} // END

Offline

#8 2016-04-20 22:53:35

rod barbee
Moderator
From: Port Ludlow, WA USA
Registered: 2012-09-24
Posts: 17,830
Website

Re: Help with targeting Home Page

I bet it's because your home page is made with CE4 Stage (via Publisher) and not with CE4 Pages

You should be able to target that page with the template name.
or with the album slug 'pages-gallery'
http://ce4.theturninggate.net/docs/doku … album_sets


Rod 
Just a user with way too much time on his hands.
www.rodbarbee.com
ttg-tips.com, Backlight 2/3 test site

Offline

#9 2016-04-20 23:30:52

trummonte
Member
From: Buena Vista, Colorado
Registered: 2012-11-11
Posts: 178
Website

Re: Help with targeting Home Page

Thanks Rod! Targeting the slug worked. By the way I did see that you can only use a function once while reading the entire documentation this time (always helps!). You are now treated to a popup after 25 seconds on the home page (which still requires work, but at least I can see it now).

Thanks again - Monte

Offline

#10 2016-04-20 23:42:15

rod barbee
Moderator
From: Port Ludlow, WA USA
Registered: 2012-09-24
Posts: 17,830
Website

Re: Help with targeting Home Page

cool! 25 seconds is probably too long, I think many people might start clicking through to the galleries before they could ever see the popup.
But then again, pop-ups that come up right away can be extremely annoying. So I guess it's a fine line between letting viewers take an initial peek around the page before the pop-up appears and making them run away screaming smile

Yep, it needs work. I can't close it and when I tried to sign up I got an error message. In case you didn't already know it.

monte-form.jpg


Rod 
Just a user with way too much time on his hands.
www.rodbarbee.com
ttg-tips.com, Backlight 2/3 test site

Offline

#11 2016-04-21 06:38:26

rod barbee
Moderator
From: Port Ludlow, WA USA
Registered: 2012-09-24
Posts: 17,830
Website

Re: Help with targeting Home Page

it works great now! Looks good too.


Rod 
Just a user with way too much time on his hands.
www.rodbarbee.com
ttg-tips.com, Backlight 2/3 test site

Offline

#12 2016-04-21 06:58:31

trummonte
Member
From: Buena Vista, Colorado
Registered: 2012-11-11
Posts: 178
Website

Re: Help with targeting Home Page

Thanks Rod! Yeah, I figure I will have to toy with the timing.

Offline

#13 2016-04-23 07:59:06

Daniel Leu
Moderator
Registered: 2012-10-11
Posts: 1,624
Website

Re: Help with targeting Home Page

Funny, I see what Rod reported two days ago... Can't close it and get error message when signing up....

I'm curious if you are successful signing up a lot of new visitors....

PS: It's just me, but I don't like these popups..... But it seems more and more people are using them :-(


Daniel Leu | Photography   
DanielLeu.com
My digital playground (eg, Backlight tips&tricks): lab.DanielLeu.com

Offline

#14 2016-04-23 08:02:58

trummonte
Member
From: Buena Vista, Colorado
Registered: 2012-11-11
Posts: 178
Website

Re: Help with targeting Home Page

Hi Daniel. You caught me while I am still trying to get it fixed.

I hear you on the popups but research still says they are the best way to go to get more subscribers, so I thought I would give it a try!

Offline

Board footer

Powered by FluxBB