Menu label text reverting back to title text when using link_before/after in wp_list_pages All in One SEO Pack Troubleshooting Forum

The support forums have a new home! Please visit All in One SEO Pack's new residence at Semper Plugins to purchase a support plan.

 
You must be logged in to post
Search Forums:


 






Minimum search word length is 4 characters – Maximum search word length is 84 characters
Wildcard Usage:
*  matches any number of characters    %  matches exactly one character

Menu label text reverting back to title text when using link_before/after in wp_list_pages

Post
New Member

Cian McCoy

posts 4

7:38 am September 10, 2009

Hi, I'm using wordpress 2.8.4 and All in One SEO Pack version 1.6.5

I've found that when I use the link_before and link_after parameters for wp_list_pages any menu labels I've set revert back to the title text, so for example In the navigation menu I want it to have the first link text as "Home". But I want to have "Welcome to my site" for the title of that page.

This has been working completly fine, using the plugins Menu Label field.

However I need to insert an empty span within anchor text so I can use the css sliding doors technique, so basically I want it to output something like

<li><a href="#">Home<span></span></a></li>

When I use the link_after parameter for wp_list_pages the plugin stops working properly, the span appears but the menu label text becomes the same as the title text like

<li><a href="#">Welcome to my site<span></span></a></li>

is this a bug or am I doing something wrong?

heres the php I'm using for wp_list_pages

<?php wp_list_pages('title_li=&link_after=<span></span>'); ?>

Any help would be much appreciated

New Member

Cian McCoy

posts 4

2:54 am September 15, 2009

Now using AIOSEO version 1.6.6 and still having the same problem, anyone else having this problem?

Is this a common problem with the plugin or am I doing something else wrong?

Any kind of response would be much appreciated Smile

New Member

Paul

posts 2

8:19 am October 5, 2009

Hi,

I've been having the same problem and discovered that it's to do with a regular expression assuming you won't have any HTML in the links produced by wp_list_pages. Not sure if we've using the same version, but my AIOSEO is version 1.6.6.2 and if you change line 668 of the all_in_one_seo_pack.php file to:

$pattern = '/<li class="page_item page-item-(\d+)([^"]*)"><a href="([^"]+)" title="([^"]+)">(.+)<\/a><\/li>/i';

It should work.

Cheers,

Paul.

New Member

Paul

posts 2

8:52 am October 5, 2009

Sorry that's not the full fix you also need to edit the aioseop_filter_callback function around line 678 and change the 'if' statement to:

if (empty($menulabel)) $menulabel = $matches[5]; else $menulabel = str_replace($matches[4],$menulabel,$matches[5]);

Otherwise it'll strip out your span tags.

Cheers,

Paul.

New Member

Cian McCoy

posts 4

7:01 am October 7, 2009

Thanks for the response Paul, I'll try out your code when I get a chance.

It would be nice if you could do this sort of thing without having to hack the code.. ho hum

ATB

Cian

New Member

scottybowl

posts 4

9:26 am January 18, 2010

Post edited 2:28 pm – January 18, 2010 by scottybowl


Just an update to this, the above regex needs to be modified slightly to work (missing some escapes), working code below:

$pattern = '/<li class="page_item page-item-(d+)([^"]*)"><a href="([^"]+)" title="([^"]+)">(.+)</a></li>/i';

Thank you Paul for your original solution, I was going slightly crazy!

New Member

scottybowl

posts 4

9:29 am January 18, 2010

Post edited 2:30 pm – January 18, 2010 by scottybowl


Ahhhhh

The forum is stripping out the escapes so my code is also incorrect :(

Can you do anything moderators?

New Member

Cian McCoy

posts 4

4:59 am February 4, 2010

Just had this problem again with a different site, managed to fix it with Paul's code plus a few escapes!

Thanks for the help guys

New Member

luckykind

posts 1

8:27 pm March 26, 2010

Thanks for the fix Scotty…

Now can we get this fix implemented in an actual version so I don't have to fix it every time I upgrade?

New Member

angelopc

Texas

posts 2

10:58 am September 6, 2010

This fix just isn't working for me.


About the WordPress Developer Forum

Forum Timezone: America/New_York

Most Users Ever Online: 205

Currently Online:
19 Guests

Currently Browsing this Topic:
1 Guest

Forum Stats:

Groups: 5
Forums: 23
Topics: 1543
Posts: 3447

Membership:

There are 6357 Members

There are 4 Admins
There are 3 Moderators