I’m new to grav and I’m trying to get an icon without text in the pinpress theme menu.
It should also contain the language plugin if possible.
Is it possible to create a page and include the twig language plugin code in it?
The icon works, but how can I get rid of the text? Only for the language menu, not for every menu.
[…] I’m trying to get an icon without text in the pinpress theme menu.
It should also contain the language plugin if possible.
That’s possible but you’ll have to edit the themes templates for that. But before doing so, you should create a child theme to prevent the loss of your edits.
Is it possible to create a page and include the twig language plugin code in it?
Yes, Twig code can be executed inside a page’s Markdown, but I don’t thinks that is what you need.
The icon works, but how can I get rid of the text?
How/where did you add an icon? Do you have some code to share?
Only for the language menu, not for every menu.
I’m afraid I don’t understand what you’re trying to achieve.
Would you mind creating a screenshot of your site and edit the screenshot to show your intensions?
That’s possible but you’ll have to edit the themes templates for that. But before doing so, you should create a child theme to prevent the loss of your edits.
That’s all done
How/where did you add an icon? Do you have some code to share?
I created a page under root-parent with icon: language but the icon is in front of the word language. I would like to have only the icon.
At the moment, the page is an External template.
As you can see in the screenshot right. That’s this Grav LangSwitcher Plugin and the code {% include 'partials/langswitcher.html.twig' %} is in header.html.twig at the moment.
So I would like to have only the language icon in the menu and the plugin as the links.
@Dans, Roughly, you should be able to create an extra menu item consisting of the language icon , which, on click, shows a dropdown of language links generated by the langswitchter plugin, using the followong approach:
If dropdowns are supported and needs to be enabled, first enabled it in /user/config/themes/pinpress.yaml.
Create two child pages to one of the existing top-level pages
In the browser, look at how the dropdown for the page with child page(s) has been created.
Edit the template for plugin LangSwitcher to create a list of language links resembling the list of links seen in step 3.
In navigation.html.twig (after line 44) of Pinpress, create a new menu-item with an outer structure as seen in step 3 and {% include %} the edited Langswitcher template to insert the language links.
You will probably have to iterate steps 4 and 5 a few times to get the dropdown menu right.
I’m trying a different way at the moment.
I changed the language-selector.html.twig file (line 2-10) to:
<i class="fa fa-language btn" data-dropdown="langSelectorList">
{% if language_display.button == 'default' or language_display.button == 'flag' %}
{% endif %}
{% if language_display.button == 'default' or language_display.button == 'name' %}
{% endif %}
<i class="fa fa-caret-down"></i>
</i>
My problem is now I can’t get it inline of the menu by adding the code {% include 'partials/langswitcher.html.twig' %} at line 27 in the navigation.html.twig file:
{% if theme_config.dropdown.enabled %}
{{ _self.loop(pages) }}{% include 'partials/language-selector.html.twig' %}
{% else %}
@Dans, Again, you are confusing me… Throughout this thread you seem to be mixing two different language plugins: LangSwitcher and the Language Selector plugin.
Please help the community to help you by creating clear and succinct questions…
Anyway, because it is still not clear how the end-result should look like, this is the last thing I’ll add to this thread…
Copy from plugin LangSwitcher, template /user/plugins/langswitcher/templates/partials/langswitcher.html.twig into your own themes folder user/themes/mytheme/templates/partials/
In template langswitcher.html.twig comment out the first and last line:
This is really very confusing. I always thought I was using the LangSwitcher plugin as I mentioned in post 3. I was wondering why the code {% include 'partials/langswitcher.html.twig' %} wasn’t working and I saw that it was just the wrong filename. I didn’t pay any further attention to it. I thought there was only one language plugin and I thought I installed the LangSwitcher plugin. I’m very sorry. And I always thought, why is this so confusing. I just want the language in the menu
Anyway, the goal was still the same. Because of you, I finally made it. Again, I’m really sorry for giving you a few headaches …