News:

Support the VirtueMart project and become a member

Main Menu

Targetable Homepage

Started by behemoth, June 20, 2019, 14:05:34 PM

Previous topic - Next topic

behemoth

What's the best way to target the homepage? (I have modules that I only want displaying on the homepage)

Previously I used the following MetaMod check:


if ( $vm->check( "pagetype = frontpage" ) )


but now the homepage is deprecated, this won't work (well, it still works, but it's not the correct approach). If as recommended I use a category for the homepage, I need to target it by ID which might change from site to site. Is there a definitive hook or anchor I can use that won't change?

I can't imagine you need version numbers, but I'm currently on VM3.4.2 on J3.9.6

Jörgen

Assign what You call the "homepage", probably a VM top category page, to a Joomla menu item and use this menu id?

Jörgen @ Kreativ Fotografi
Joomla 3.9.18
Virtuemart 3.4.x
Olympiantheme Hera (customized)
This reflects current status when viewing old post.

behemoth

It still relies on me knowing (or looking up) an ID before I can target it.

I've decided to use an article instead because the home category was showing in my menu and I didn't want it to.