modify wordpress wp_nav_menu url - php

How could I change the code generated by wp_nav_menu?
Right now it generates:
<ul class="rounded ">
<li class="arrow">Menus</li>
</ul>
I'd like it to look like this:
<ul class="rounded ">
<li class="arrow">Menus</li>
</ul>
i found this link, but could not get it working properly.
http://wordpress.org/support/topic/how-do-i-modify-wp_nav_menu-link-hrefs?replies=2

The link from support forum doesn't talk about the version number of the wordpress that he is using. I am currently on 3.2.1, it is having the menu options under Appearance section. You can check out this awesome post on menus. It gives you an option of modifying the href as well.
I hope you are on version > 3. If not possible to update then it has to be done using wp functions.

Related

How to use original navigation menu HTML of which structure is different from that of “<?php wp_nav_menu(); ?>”?

I'm new to wordpress.
Is it possible to use original HTML for navigation menu and edit its titles and URLs in wordpress admin?
My navigation HTML looks like this.
<nav>
<ul id="menu">
<li><a>Menu1</a>
<div class="slideToggleThis">
<ul>
<li><a>Menu1-1</a>
<ul>
<li>Menu1-1-1</li>
<li>Menu1-1-2</li>
<li>Menu1-1-3</li>
</ul>
</li>
<li><a>Menu1-2</a>
<ul>
<li>Menu1-2-1</li>
<li>Menu1-2-2</li>
<li>Menu1-2-3</li>
</ul>
</li>
</ul>
</div>
</li>
</ul>
<ul id="hamburger">
<li><a id="hamburgerFont"></a>
<ul>
<li><a>MenuS</a>
<ul>
<li>MenuA</li>
<li>MenuB</li>
<li>MenuC</li>
</ul>
</li>
</ul>
</li>
</ul>
</nav>
As you can see from this, my nav has div between ul and li. The div is necessary because the nav is arranged with Flexbox, thus slideToggle from JQuery doesn't work properly without it (slideToggle changes affected elements' display to block which is not good for display: flex;).
As long as I know, HTML code created by "?php wp_nav_menu(); ?" is simple combination of ul and li which is different from mine.
Are there any solution for me to edit my original HTML navigation menu in wordpress admin? or should I manually change the php files every time I change the contents in the menu?
Thank you for reading.
There is a way of changing the structure of the WordPress menu. I'm not that good in explaining the exact code but this url may help you:
https://github.com/roikles/Wordpress-Bem-Menu
He creates a new navigation setup, based on BEM method, to create a new structure.
By calling bem_menu( you can add the navigation (read docs for more info). Here you can adjust your settings.

Image source path changing on different pages

I'm using Genesis and I have a functions.php that I have inserted images there using hooks to the footer.
I've used a widget to insert an image to the header.
The images are displayed correctly when viewed in the homepage, but when I switch a page, the images are not displayed.
Further investigation concludes that wordpress is seeking the file with a wrong path source.
That's the path source in the homepage - wp-content\themes\childTheme-Almog\images\linkedin.png
And wordpress is looking for it as it should.
However, on another page, called 'X', wordpress is looking for the same image as follows:
\wordpress\x\wp-content\themes\childTheme-Almog\images\linkedin.png
As you can tell, it adds to the path the page name as a folder, which it shouldn't do, because the image is not there.
Is there a way to make wordpress look for the image like it does on the homepage?
Here's how my images are implemented in my functions.php:
<div class="d_footer">
<ul id="list_left">
<li class="foot" id="ft_text1"><img src="wp-content\themes\childTheme-Almog\images\phone.png" alt="phone">
<span style="color: #969697">|</span><span style="margin-left:30px;"></span><img src="wp-content\themes\childTheme-Almog\images\envelope.png" alt="envelope"></li>
<li class="foot" id="ft_text2"></li>
</ul>
<ul class="foot" id="list_right">
<li id="ft_text3"><img src="\wp-content\themes\childTheme-Almog\images\linkedin.png" alt="linkedin" align="left">Almog's linkedin profile</li>
<li id="ft_text4"></li>
</ul>
</div>
You really should be using Wordpress' get_stylesheet_directory_uri variable to alleviate problems with paths like this.

Expression Engine 3 pagination with page_uri

I have looked for a while for a solution to this, but have been unsuccessful so far. Not sure if it's me, or if there's a problem with the pagination functionality.
What I'm trying to do
When on a page within a certain channel, I want to have 'prev' and 'next' buttons to click through to the next article in the channel. These links must use the page_uri set for each page.
What I've tried
I have a channel full of pages. In the template, I have added:
{exp:channel:entries channel="project" dynamic="no" orderby="date" sort="desc" limit="1" paginate="bottom"}
<div class="container-fluid project-section pagination-bar">
<div class="container">
<div class="col-md-12">
{paginate}
{pagination_links}
<ul>
{previous_page}
<li>Previous Page</li>
{/previous_page}
{next_page}
<li>Next Page</li>
{/next_page}
</ul>
{/pagination_links}
{/paginate}
</div>
</div>
</div>
{/exp:channel:entries}
This is adding the links to the bottom of the page, but when clicking on them the URLs are just loading the same URL you're currently on, then adding /P1 to the end.
I need it to use the page_uri added in the CMS so that it clicks through properly and doesn't affect SEO on the site.
Any help appreciated on this one, thanks
Pagination isn't really the way around this. You should look into Next/Previous Entry Linking. It'll give you a full link to the previous and next entry. Just make sure to keep it outside your channel entries loop.
For example you'd want something like:
{exp:channel:prev_entry channel="project"}
View previous project
{/exp:channel:prev_entry}
{exp:channel:next_entry channel="project"}
View next project
{/exp:channel:next_entry}
Assuming your projects all live in a section called projects you'd be linking between
/projects/example-project-1
/projects/example-project-2
/projects/example-project-3

prestashop changing page icon doesn't work

I am using Prestashop for the first time. I try to change icons in the default theme but the change doesn't reflect on the UI
E.g: in block contact info, I have originally
<li>
<i class="icon-phone"></i>{l s='Call us now:' mod='blockcontactinfos'}
<span>{$blockcontactinfos_phone|escape:'html':'UTF-8'}</span>
</li>
I want to remove
<i class="icon-phone"></i>
and add my own icon <img src="\img\icons\call.png" />
But the UI still look the same after I changed the code to
<li>
<!--<i class="icon-phone"></i>-->
<img src="\img\icons\call.png" />{l s='Call us now:' mod='blockcontactinfos'}
<span>{$blockcontactinfos_phone|escape:'html':'UTF-8'}</span>
</li>
I use chrome inspector and see that the source code doesn't change at all. How can I add my own icons in prestashop?
It's because Prestashop uses 1) Module overrides and 2) Template cache system. You should disable cache memory in BO in Settings -> Performance and then clean the cache with the button on the top right. Next You need to edit:
not: root/modules/blockcontactinfos/blockcontactinfos.tpl
but root/themes/yourthemename/modules/blockcontactinfos/blockcontactinfos.tpl file.
This should help fix Your problems :)

Opencart - how to find which file add a menu on admin header

I'm trying to add a custom menu on my admin dashboard as a dropdown link that's based on Opencart. I've changed my header.tpl and related files and it's ok . The problem is here that when it shows the menu , it adds some other links that i don't want to be there :(
I've checked vqmode file and it doesn't have anything for that . i don't know what is wrong with me that i can't find the file that add those menus ?
Link To Screenshot
this is what i have in header.tpl file for that menu :
<li id="help"><a class="top" onclick="window.open('xxxx');"><?php echo $text_help; ?>
<ul id="training">
<li><?php echo $text_training_video; ?></li>
</ul>
</a>
</li>
and this is what i have after rendering :
<li id="help" class="sfHover"><a class="top" onclick="window.open('xxx/support/');">Help </a><ul id="training" style="display: block; visibility: visible;"><a class="top" onclick="window.open('xxx/support/');">
</a><li><a class="top" onclick="window.open('xxx/support/');"></a>Trainig Videos</li>
</ul>
</li>
From the screenshot you've added it seems like you're using an admin theme installed via vqmod file. The links that appear in the 'Help' menu are default opencart links. So you need to remove those links in header.tpl or from the admin theme xml file.
Steps to try:
Rename the vqmod/xml folder and check. If the issue doesn't exist, then searched in xml files.
(step 1 failed to help) Search again in admin\view\template\common\header.tpl to see whether there's anything under <li id="help"><a class="top"><?php echo $text_help; ?></a>.
(step 1 & 2 failed to help) Rename 'admin\view\template\common\header.tpl' to confirm that you were working on the correct template file.

Categories