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-11-22 23:15:00

PhilippeH
Member
From: Paris, France
Registered: 2014-04-11
Posts: 167

Underline menu items

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

#2 2016-11-22 23:37:08

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

Re: Underline menu items

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

#3 2016-11-23 00:15:42

PhilippeH
Member
From: Paris, France
Registered: 2014-04-11
Posts: 167

Re: Underline menu items

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

#4 2016-11-23 00:42:53

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

Re: Underline menu items

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

#5 2016-11-23 00:47:34

charlie.choc
Member
From: Marietta, GA
Registered: 2014-01-09
Posts: 359
Website

Re: Underline menu items

I think I had to resave my wordpress theme when I changed the custom css for my menu.

Offline

#6 2016-11-23 01:46:29

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

Re: Underline menu items

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

#7 2016-11-23 01:50:16

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

Re: Underline menu items

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

#8 2016-11-23 01:57:00

charlie.choc
Member
From: Marietta, GA
Registered: 2014-01-09
Posts: 359
Website

Re: Underline menu items

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

Offline

#9 2016-11-23 01:59:28

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

Re: Underline menu items

rod barbee wrote:

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

#10 2016-11-23 02:06:11

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

Re: Underline menu items

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

#11 2016-11-23 02:08:51

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

Re: Underline menu items

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.

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

#12 2016-11-23 05:44:29

Ben
Moderator
From: Melbourne, Australia
Registered: 2012-09-29
Posts: 4,399

Re: Underline menu items

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.

Offline

#13 2016-11-23 05:45:40

PhilippeH
Member
From: Paris, France
Registered: 2014-04-11
Posts: 167

Re: Underline menu items

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!

http://test.vuedailleurs.com

Philippe

Last edited by PhilippeH (2016-11-23 05:46:55)

Offline

#14 2016-11-23 06:05:05

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

Re: Underline menu items

Ben wrote:
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

#15 2016-11-23 11:00:02

Matthew
Administrator
From: San Francisco, CA
Registered: 2012-09-24
Posts: 5,795
Website

Re: Underline menu items

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);

Matt

The Turning Gate, http://theturninggate.net

Offline

Board footer

Powered by FluxBB