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.
You are not logged in.
Pages: 1
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
Monte Trumbull
https://www.montetrumbull.com/
Offline
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
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
Monte Trumbull
https://www.montetrumbull.com/
Offline
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
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!
Monte Trumbull
https://www.montetrumbull.com/
Offline
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
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
Monte Trumbull
https://www.montetrumbull.com/
Offline
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
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
Monte Trumbull
https://www.montetrumbull.com/
Offline
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
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.
Rod
Just a user with way too much time on his hands.
www.rodbarbee.com
ttg-tips.com, Backlight 2/3 test site
Offline
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
Thanks Rod! Yeah, I figure I will have to toy with the timing.
Monte Trumbull
https://www.montetrumbull.com/
Offline
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
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!
Monte Trumbull
https://www.montetrumbull.com/
Offline
Pages: 1