So basically, the ‘Pages’ widget just prints out a list of all pages names as links (as you all probably know).
Although, these anchor tags do not have any titles, and that is frowned upon in the SEO world.
I would like to modify this to have the titles simply as the name of the page.
For example, I would like to turn this:
<ul>
<li class="page_item page-item-3307"><a href="http://www.domain.com/about-us/">About Us</a></li>
<li class="page_item page-item-3315"><a href="http://www.domain.com/blog/">Blog</a></li>
<li class="page_item page-item-100"><a href="http://www.domain.com/contact/">Contact Us</a></li>
</ul>
Into this:
<ul>
<li class="page_item page-item-3307"><a href="http://www.domain.com/about-us/" title="About Us">About Us</a></li>
<li class="page_item page-item-3315"><a href="http://www.domain.com/blog/" title="Blog">Blog</a></li>
<li class="page_item page-item-100"><a href="http://www.domain.com/contact/" title="Contact Us">Contact Us</a></li>
</ul>
I have had a look around within the wp-includes/default-widgets.php
file, although it is all pushed through a function called wp_list_pages
.
What must I do to achieve this?
PS. Using WordPress 3.8.1
A fast and short solution would be –
And if you want a proper way, you could extend
Walker_Page
(ref: post-template.php) class and set the Pages Widget walker to class withwidget_pages_args
hook