lewissn
November 30, 2017, 1:10pm
#1
I’d like to display a telephone number in the menu bar on my website. I did succeed a while ago, but it wasn’t responsive (i’m not so good with coding), and it didn’t work well, especially on smaller screens.
If anyone has a solution to this, that would be great!
My website
The theme i’m using is Woo, if that matters.
Thanks!
Hi @lewissn , here is one way:
In your site config file add a menu entry without a URL, like this:
- text: Subscribe
link: "#subscribe"
- text: 123-456-7890
link: ""
Then find this bit of Twig in your navigation.html.twig template file (in Partials template folder):
<a href="{% if "#" in mitem.link %}{{ base_url_absolute }}/{{ mitem.link }}{% else %}{{ mitem.link }}{% endif %}" {% if not "#" in mitem.link %}class="smoothscroll"{% endif %}>{{ mitem.text }}</a>
And change it to:
{% if mitem.link %}
<a href="{% if "#" in mitem.link %}{{ base_url_absolute }}/{{ mitem.link }}{% else %}{{ mitem.link }}{% endif %}" {% if not "#" in mitem.link %}class="smoothscroll"{% endif %}>{{ mitem.text }}</a>
{% else %}
{{ mitem.text }}
{% endif %}`