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-12-06 21:19:16

angel
Member
From: Israel
Registered: 2013-06-18
Posts: 45
Website

Is there a crack / fix for alternative content.

I am using TTG CE4 Publisher to upload content for our Contact Page. Is there a way to display alternate content for desktop and mobile viewers?

Offline

#2 2016-12-06 23:39:25

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

Re: Is there a crack / fix for alternative content.

not via Publisher. But you could use phplugins to insert content to only mobile devices using the CE4-MOBILE G_STYLE identifier along with G_SLUG to target specific albums

http://ce4.theturninggate.net/docs/doku … e4_engines

http://ce4.theturninggate.net/docs/doku … bility_api

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

#3 2016-12-07 10:52:42

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

Re: Is there a crack / fix for alternative content.

In the copy area, you could do something like:

<div id="is-desktop">
	<p>I only display on desktop.</p>
</div>

<div id="is-mobile">
	<p>I only display on mobile.</p>
</div>

In custom CSS, then:

#is-mobile { display: none; }
@media screen and ( max-width: 920px ) {
	#is-desktop {display: none; }
	#is-mobile { display: block; }
}

Matt

The Turning Gate, http://theturninggate.net

Offline

#4 2016-12-09 05:10:47

angel
Member
From: Israel
Registered: 2013-06-18
Posts: 45
Website

Re: Is there a crack / fix for alternative content.

Thank you Matthew.

I appreciate you providing an easy and effective solution.

It works!

Offline

#5 2016-12-09 14:31:46

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

Re: Is there a crack / fix for alternative content.

Glad to hear. big_smile


Matt

The Turning Gate, http://theturninggate.net

Offline

#6 2017-01-25 22:04:04

angel
Member
From: Israel
Registered: 2013-06-18
Posts: 45
Website

Re: Is there a crack / fix for alternative content.

Please let me know how I would load up an alternative menu for mobile devices. I suppose this is done via phplugins?

Would you kindly include the necessary code.

Thank you.

Offline

#7 2017-01-26 01:34:06

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

Re: Is there a crack / fix for alternative content.

There is a phplugins hook named ttg_navigation. It can be used to replace the navigation.
There is also an Advanced Setting in the Page Templates that will disable navigation style and scripting. (you probably don't need to do that)

Ideally, there would be a way to feed on Menu Set to desktops and another Menu Set to mobile devices. This option does not exist, and I rather doubt it will since this is the first time I've seen a request to do what you're asking.

So my guess is that you'd need to hard code navigation for both desktop and mobile. No one can do this for you since you're the only one who knows what navigation you need. But you could copy the structure that exists (look a the page source code) and modify as needed.

If you're using drop down menus, this also means that you'd need to manually add new menu items every time you added a new album, album set, or page.

To feed one menu to mobile devices and one to desktops, you can use custom css that will use the appropriate menu depending on the width of the browser.

I think this should work in phplugins to create the menus. This is just a sample and you'll need to create your own menus using your urls and names. Use a plain text editor to make your changes.
This is untested.

/* Navigation replacement 
==========================================*/

function ttg_navigation( $style, $path ) { 
	
	echo '
	
	<ul class="primary-menu menu mobile-nav">
		<li class="menu-item"><a href="/">Home</a></li>
		<li class="menu-item menu-item-has-children"><a href="/galleries">Galleries</a>
			<ul class="sub-menu">
				<li class="menu-item"><a href="">Sub-item 1</a></li>
				<li class="menu-item"><a href="">Sub-item 2</a></li>
			</ul>
		</li>
		<li class="menu-item"><a href="/about">About</a></li>
		<li class="menu-item"><a href="/contact">Contact</a></li>
	</ul>
	<!-- /Mobile navigation -->
	
		
	<ul class="primary-menu menu desktop-nav">
		<li class="menu-item"><a href="/">Home</a></li>
		<li class="menu-item menu-item-has-children"><a href="/galleries">Galleries</a>
			<ul class="sub-menu">
				<li class="menu-item"><a href="">Sub-item 1</a></li>
				<li class="menu-item"><a href="">Sub-item 2</a></li>
			</ul>
		</li>
		<li class="menu-item"><a href="/about">About</a></li>
		<li class="menu-item"><a href="/contact">Contact</a></li>
	</ul>
	<!-- /Desktop navigation -->
	';
	}
	
	
	return false;
} // END

In your custom css, add this:

/*Mobile or Desktop navigation media queries
====================================*/

@media only screen and (max-width: 1024px) {
	ul.desktop-nav {
	display: none;
	}
}

@media only screen and (min-width: 1025px) {
	ul.mobile-nav {
	display: none
	}
	ul.desktop-nav {
	display: block;
	}
}

I'm not really sure if the ul.desktop-nav { display: block;} is really needed in that second media query.

There also looks to be a way of using php to detect whether or not a mobile device is being used and then feeding the appropriate menu depending on device.


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

Offline

Board footer

Powered by FluxBB