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
Hello,
I followed the tips given in tips and tricks, to bring out a menu item from the current page, but I encounter some problems.
This works on my test site: http://test.vuedailleurs.com
Except for the blog tab and for the contact tab. Next page where I am. That is, if I come from the home page to the contact page it works. However oddly if I come from the gallery page to the contact page it does not work.
For the Blog tab it does not work at all.
Philippe
Offline
One problem is that you have the menu item background color set to the same as the page background color:
.selected {
background-color: #313131 !important;
color: white !important;
}
#313131 is the same color as your page background.
The reason it's not working on your blog page is that it looks to me that the blog page template does not have phplugins enabled, or it's not using the needed phplugins file. (the needed script is not showing up on the page source code)
Does the page template being used for the theme have phplugins enabled? If so, it's not being applied and is something Matt will have to look at.
also, check you menu set. For example, on your menu, the link to the contact page is
http://test.vuedailleurs.com/?page=contact
But in other menus it's
http://test.vuedailleurs.com/contact.php
So check your page templates to make sure they're all using the same menu set.
If they are, then this menu problem could be a .htaccess file issue
Rod
Just a user with way too much time on his hands.
www.rodbarbee.com
ttg-tips.com, Backlight 2/3 test site
Offline
Thank you for your reply,
I do not want the background color of the menu to change, but only the color of the text. That's why it has the same background color as the page.
The blog page has the same phplugins enabled.
As for the menu, I have only one menu set.
Philippe
Offline
It looks like the WordPress themes are not using phplugins. Something for Matt to look into.
I'm guessing the other issue is a .htaccess issue. On your Galleries page, the link to your Home page goes to:
http://test.vuedailleurs.com/?page=home
and the link to your Contact page goes to: http://test.vuedailleurs.com/?page=contact
note the ?page=contact at the end of the url. It should be just /contact.php
Have you tried both clearing template cache (Designer > Templates > Clear Template Cache) and updating album files (Backlight > Publisher Dashboard: Under special Links)
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 think I had to resave my wordpress theme when I changed the custom css for my menu.
Charlie
www.stalkinglight.com
Offline
Phplugins are supported by the Backlight WP theme, but ttg_scripts() is not. You need to use the 'wp_enqueue_script' feature to add custom scripts or javascript code to your WP child theme.
I have something like this in my WP child theme functions.php file:
function my_theme_enqueue_inline_script(){
if( wp_script_is('jquery','done') ){
echo '<script>
... put your javascript code here ....
</script>';
}
}
add_action('wp_footer', 'my_theme_enqueue_inline_script', 21); // priority 21 to trigger after wp_enqueue_scripts (20)
Daniel Leu | Photography
DanielLeu.com
My digital playground (eg, Backlight tips&tricks): lab.DanielLeu.com
Offline
Ah. I wonder about placing the script in the ttg_head hook?
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 tried moving my '.selected' code from ttg_scripts to ttg_head and it doesn't work on any page, not just the blog. fwiw
Charlie
www.stalkinglight.com
Offline
Ah. I wonder about placing the script in the ttg_head hook?
Adding it to the ttg_head hook might not work for every type of code due to dependencies. wp_enqueue_script() should be used to add custom javascript code. See WP documentation for more.
Daniel Leu | Photography
DanielLeu.com
My digital playground (eg, Backlight tips&tricks): lab.DanielLeu.com
Offline
I already tried it. It adds the script to the end of the head section. But even though I used $(document).ready(function() {
the script doesn't appear to work.
Are you using wp_enqueue_script() via a child theme?
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 already tried it. It adds the script to the end of the head section. But even though I used $(document).ready(function() {
the script doesn't appear to work.Are you using wp_enqueue_script() via a child theme?
Yes. See as well http://community.theturninggate.net/vie … 173#p42173
Daniel Leu | Photography
DanielLeu.com
My digital playground (eg, Backlight tips&tricks): lab.DanielLeu.com
Offline
I already tried it. It adds the script to the end of the head section. But even though I used $(document).ready(function() {
the script doesn't appear to work.
I found that jQuery loads after the head. $ is therefore not defined till later on in the page. Placing custom JS within ttg_scripts works for me.
Offline
I cleared the cache, I checked everything looks OK.
What is strange is when I am on the homepage, that I go to the contact page I arrive on the page /contact.php
On the other hand if I am on the gallery page or the blog page, and I go to the contact page I come across /? Page = contact
All this seems very strange to me!
Philippe
Last edited by PhilippeH (2016-11-23 05:46:55)
Offline
rod barbee wrote:I already tried it. It adds the script to the end of the head section. But even though I used $(document).ready(function() {
the script doesn't appear to work.I found that jQuery loads after the head. $ is therefore not defined till later on in the page. Placing custom JS within ttg_scripts works for me.
But the ttg_scripts hook isn't included in the WordPress theme
Rod
Just a user with way too much time on his hands.
www.rodbarbee.com
ttg-tips.com, Backlight 2/3 test site
Offline
If you want to load your own script into the Wordpress theme, then Daniel is on the right track. You need to add script via the child theme's functions.php file, while observing Wordpress' no-conflict protocol. Something like this, where "$..." is whatever you're doing:
function enqueue_custom_script() {
if( wp_script_is('jquery','done') ){ ?>
<script>
(function($) {
$...
})( jQuery );
</script>
<?php }}
add_action('wp_footer', 'enqueue_custom_script', 22);
Offline
Pages: 1