Posts: 166
Threads: 24
Joined: Jul 2012
2013-05-25, 00:24:54
(This post was last modified: 2013-05-25, 00:25:41 by lnickel.)
This plugin does the job and kicks arse!!!! Thanks mvlcek for all your work!! I have one question and I'm sure I'll have many more but is it possible to pin point any of the links printed out and make them non-links.
So something like this where any of these items simply do not have a page assigned only to hover to show other children links. Perhaps the parent link is not clickable but shows the children. Is this possible?
Parent Link
-----Child Link
-----Child Link
---------Child Child Link
Again, a huge thank your time!!!!
thanks
Lance
Posts: 2,094
Threads: 54
Joined: Jan 2011
(2013-05-25, 00:24:54)lnickel Wrote: This plugin does the job and kicks arse!!!! Thanks mvlcek for all your work!! I have one question and I'm sure I'll have many more but is it possible to pin point any of the links printed out and make them non-links.
So something like this where any of these items simply do not have a page assigned only to hover to show other children links. Perhaps the parent link is not clickable but shows the children. Is this possible?
You will need to use custom rendering and display a link or no link depending on $item->hasChildren.
Posts: 166
Threads: 24
Joined: Jul 2012
2013-05-25, 03:26:22
(This post was last modified: 2013-05-25, 03:34:06 by lnickel.)
(2013-05-25, 01:58:11)mvlcek Wrote: (2013-05-25, 00:24:54)lnickel Wrote: This plugin does the job and kicks arse!!!! Thanks mvlcek for all your work!! I have one question and I'm sure I'll have many more but is it possible to pin point any of the links printed out and make them non-links.
So something like this where any of these items simply do not have a page assigned only to hover to show other children links. Perhaps the parent link is not clickable but shows the children. Is this possible?
You will need to use custom rendering and display a link or no link depending on $item->hasChildren.
Thank you for your assistance!! I'm not sure how to implement that.
Currently I have :
Code: <ul class="megamenu">
<li><?php get_i18n_link('index');?></li>
<li class="megamenu_drop"><?php get_i18n_link('about-us');?>
<div class="dropdown_3columns dropdown_container">
<div>
<ul><?php get_i18n_navigation('about-us', 1, 100, I18N_SHOW_NORMAL); ?></ul>
</div>
</div>
</li>
....
I'm not sure how to implement the code you provide on your site:
Code: <li class="<?php echo $item->classes; ?>">
<a href="<?php echo htmlspecialchars($item->link); ?>">
<?php echo htmlspecialchars($item->text); ?>
</a>
<?php if ($item->isOpen) { ?>
<ul><?php $item->outputChildren(); ?></ul>
<?php } ?>
</li>
get_i18n_navigation($slug, $minlevel=0, $maxlevel=0, $show=I18N_SHOW_NORMAL, $component=null)
What do I reference in the component var? I appreciate your help!!!!!
Posts: 166
Threads: 24
Joined: Jul 2012
2013-05-25, 06:18:58
(This post was last modified: 2013-05-25, 06:28:21 by lnickel.)
So I take this code and make a component from it and call it it as a param in the get_nav function. Cool. Just dont know how to do the if/else
I've tried it but doesnt work.
Code: <li class="<?php echo $item->classes; ?>">
<?php if ($item->hasChildren) {
<a href="<?php echo htmlspecialchars($item->link); ?>">
<?php echo htmlspecialchars($item->text); ?>
</a>
} else {
<?php echo htmlspecialchars($item->text); ?>
} ?>
<?php if ($item->isOpen) { ?>
<ul><?php $item->outputChildren(); ?></ul>
<?php } ?>
</li>
Heck I'm such a PHP noob its embarassing!!
Here is what I'm trying to achieve. Some of the list items weather or not they are parent or child are not click-able.
Posts: 2,094
Threads: 54
Joined: Jan 2011
(2013-05-25, 06:18:58)lnickel Wrote: So I take this code and make a component from it and call it it as a param in the get_nav function. Cool. Just dont know how to do the if/else
PHP code between <?php and ?>, HTML outside:
Code: <li class="<?php echo $item->classes; ?>">
<?php if ($item->hasChildren) { ?>
<a href="<?php echo htmlspecialchars($item->link); ?>">
<?php echo htmlspecialchars($item->text); ?>
</a>
<?php } else { ?>
<?php echo htmlspecialchars($item->text); ?>
<?php } ?>
<?php if ($item->isOpen) { ?>
<ul><?php $item->outputChildren(); ?></ul>
<?php } ?>
</li>
You could of course also write the else-part simply as
Code: <?php } else { echo htmlspecialchars($item->text); } ?>
Posts: 166
Threads: 24
Joined: Jul 2012
2013-05-25, 06:42:10
(This post was last modified: 2013-05-25, 06:52:50 by lnickel.)
Thanks mvlcek! I'll give it a try and see! Thank you!!!
Update: I gave it a try and it worked. Can it get more granular than that?
Some links may have children but dont actually have it's own page.
Sorry for all the ?'s!!!!! I will keep hunting! Thanks for your input!
Posts: 346
Threads: 27
Joined: Sep 2010
Did you manage to do this, lnickel?
If not (or just as a reference for others hoping to do the same), you can use Custom Fields to create a custom status (like 'nopage') for pages in the menu that takes either the value 'true' or 'false'. Then to alter the appearance of pages in the menu that have children (but do not have their own pages) use a conditional statement like:
Code: if($item->hasChildren && $item->nopage=='true') {
// output
}
Posts: 166
Threads: 24
Joined: Jul 2012
(2013-05-30, 21:40:32)Angryboy Wrote: Did you manage to do this, lnickel?
If not (or just as a reference for others hoping to do the same), you can use Custom Fields to create a custom status (like 'nopage') for pages in the menu that takes either the value 'true' or 'false'. Then to alter the appearance of pages in the menu that have children (but do not have their own pages) use a conditional statement like:
Code: if($item->hasChildren && $item->nopage=='true') {
// output
}
Aw man Angryboy!!! You made me a happyBoy! I will try this in a jiffy! I was converting everything to wp....was frustrated! I will use this on my next project. Many thanks!!!
Posts: 346
Threads: 27
Joined: Sep 2010
2013-05-31, 01:26:46
(This post was last modified: 2013-05-31, 01:28:28 by Angryboy.)
Hope it's helpful. If you're feeling the urge to convert to WordPress again in the future due to any GetSimple frustrations, feel free to PM me. *smiles*
[For future reference: if you have plugin-specific queries, it is better to keep those questions in the support threads that the original authors publish.]
Posts: 166
Threads: 24
Joined: Jul 2012
2013-05-31, 01:34:20
(This post was last modified: 2013-05-31, 01:40:06 by lnickel.)
(2013-05-31, 01:26:46)Angryboy Wrote: Hope it's helpful. If you're feeling the urge to convert to WordPress again in the future due to any GetSimple frustrations, feel free to PM me. *smiles*
[For future reference: if you have plugin-specific queries, it is better to keep those questions in the support threads that the original authors publish.]
Thanks angryboy. I was on a time constrained project and really wanted to use GS. As with anything there is a learning curve - I should of really taken that into consideration. I'm well versed into wp and themeing so I went back only because of the time but teetering on just using GS.... I really want to just use GS for future projects because of the 'no-fuss' editing. I don't need that layer for management like clients do. Many thanks!!! Sorry for putting this in the wrong place!
Posts: 9
Threads: 1
Joined: Jun 2014
2014-11-28, 09:27:21
(This post was last modified: 2014-11-28, 09:29:07 by mackur.)
Hello,
I would like non clickable only top level menu if I have a children.
I use in template:
Code: <?php if(function_exists(get_i18n_navigation)){ get_i18n_navigation($slug, $minlevel=0, $maxlevel=2, $show=I18N_SHOW_MENU, $component=null); } else { get_navigation(get_page_slug(FALSE)); }} ?>
Could you help me
Posts: 1,927
Threads: 88
Joined: Apr 2010
Code: <?php function_exists('get_i18n_navigation') ? get_i18n_navigation(return_page_slug(), 0, 100, I18N_SHOW_MENU) : get_navigation(return_page_slug()); ?>
Posts: 9
Threads: 1
Joined: Jun 2014
Thanks for code
(2014-11-28, 16:49:22)Oleg06 Wrote: Code: <?php function_exists('get_i18n_navigation') ? get_i18n_navigation(return_page_slug(), 0, 100, I18N_SHOW_MENU) : get_navigation(return_page_slug()); ?>
After my pasted also top level menu which has a children is clickable and is link.
Mayby I must change something in file frontend.class.php
Posts: 1,927
Threads: 88
Joined: Apr 2010
Posts: 166
Threads: 24
Joined: Jul 2012
2014-11-29, 00:04:35
(This post was last modified: 2014-11-29, 00:55:30 by lnickel.)
Try using the I18N Custom Fields.
1. Install the plugin
2. Create two fields - one with something like noPage for the name, noPage for the label and select the Type to be Dropdown. Give it two selections with the something like hasLink and no Link then save
3. Go to one of your pages and now you should be able to see those custom fields in the page options.
4. Go to components and input something like this into a new component and name it 'links'.
This will rewrite the general output of the il8n nav.
PHP Code: <li class="<?php echo $item->classes; ?>"> <?php if ($item->nopage == 'noLink') { echo htmlspecialchars($item->text); } elseif ($item->nopage == 'hasLink') { ?> <a href="<?php echo htmlspecialchars($item->link); ?>"> <?php echo htmlspecialchars($item->text); ?> </a> <?php } else { ?> <a href="<?php echo htmlspecialchars($item->link); ?>"> <?php echo htmlspecialchars($item->text); ?> </a> <?php }?> <?php if ($item->isOpen) { ?> <button class="toggleExpand"><i class="fa fa-arrow-circle-right"></i></button> <ul class="sub-menu"><?php $item->outputChildren(); ?></ul> <?php } ?> </li>
5. Now in your navigation code in your template (if you are using I18N navigation) which you probably should be. Pass the 'links' param into that piece of code like this. This will give the option to turn off the link for the navigation via the page options. Its a per item thing.
PHP Code: <?php get_i18n_navigation(return_page_slug(),0,100, I18N_SHOW_MENU, 'links'); ?>
Posts: 9
Threads: 1
Joined: Jun 2014
2014-11-30, 07:57:41
(This post was last modified: 2014-11-30, 07:58:54 by mackur.)
Thank you very much. It works very nice
Posts: 161
Threads: 6
Joined: Jan 2010
A similar way I do it that also uses I18N Custom Fields is I create a custom field called "redirect" and then structure the pages so that if the parent is supposed to link to the first child, then the parent page has no content but has the URL of the first child (either root-relative or absolute) in the "redirect" field. Then in the theme's template.php file, I add the following PHP before any HTML is output:
PHP Code: <?php
if( return_custom_field( 'redirect' ) !== '' ){ header( 'HTTP/1.1 301 Moved Permanently' ); header( 'Location: ' . return_custom_field( 'redirect' ) ); exit(); }
?>
This is also a little more flexible as you can add external links to your primary navigation too using this method.
Posts: 24
Threads: 5
Joined: May 2013
(2013-05-25, 06:31:47)mvlcek Wrote: (2013-05-25, 06:18:58)lnickel Wrote: So I take this code and make a component from it and call it it as a param in the get_nav function. Cool. Just dont know how to do the if/else
PHP code between <?php and ?>, HTML outside:
Code: <li class="<?php echo $item->classes; ?>">
<?php if ($item->hasChildren) { ?>
<a href="<?php echo htmlspecialchars($item->link); ?>">
<?php echo htmlspecialchars($item->text); ?>
</a>
<?php } else { ?>
<?php echo htmlspecialchars($item->text); ?>
<?php } ?>
<?php if ($item->isOpen) { ?>
<ul><?php $item->outputChildren(); ?></ul>
<?php } ?>
</li>
You could of course also write the else-part simply as
Code: <?php } else { echo htmlspecialchars($item->text); } ?>
Hi mvlcek,
I am using i18n for php8 but the component paramter doesn't work, is possible to fix it? I need to put there a custom rendering. Thanks
Posts: 24
Threads: 5
Joined: May 2013
SOLVED:
replace I18nNavigationItem with __construct
in line:361 in plugins/i18n_navigation/frontend.class.php
|