• Hi All,

    I’m trying to figure out how I can change the link text that comes from wp_list_pages template function.

    Currently my page names are short so that I can fit them horizontal in my menu bar. For example, the About Us link.

    And of course the page title is ‘About Us’. However, I’d like the actual page title to be something longer in length, like
    ‘About My Really Cool Website’.

    But, this long text is too long for my horizontal menu bar. How could I change my page’s text for links (generated by wp_list_pages/or alternative)? I’ve searched for a plugin but was unable to find one.

Viewing 15 replies - 1 through 15 (of 21 total)
  • As it happens, I’ve just coded this, and was wondering where I could find someone to help test it. Are you game?

    Thread Starter theMaab

    (@themaab)

    Sure Thing!!!

    I was thinking I was going to have to make static links in the template to accomplish this. This will be a much better alternative, Thanks!

    I’ll let you know what I find.

    Thread Starter theMaab

    (@themaab)

    Okay, got the plugin installed and activated, but right away I got this error in my menu bar where the page links would appear:

    Warning: preg_replace() [function.preg-replace]: Unknown modifier ‘O’ in /home/bbash/public_html/wp-content/plugins/alt-link-text/alt-link-text.php on line 108

    Possibly cause I have an ampersand (&) in my page title?

    theMaab: LOL, how many times did you click the Post button? I see 5 identical replies. ??

    I’m trying to figure out how I can change the link text that comes from wp_list_pages template function.

    To do this (and add custom link titles), I just create a link myself like this:

    <a href="<?php bloginfo('url'); ?>/about-us/" title="Info about my website">About My Really Cool Website</a>

    Thread Starter theMaab

    (@themaab)

    Yeah, I dont know what happen there, ?? Sorry about that everyone.

    iridiax: That’s not exactly what I want to do. I would like to have longer page titles for my Pages. The problem is when you create the links for the pages, in my horizontal nav bar (which is 900px wide) the long page titles are too long. So, I would like to have an alternate string to use for the page links created by wp_list_pages.

    Technokinetics : Thanks a mill for the plugin. But it doesn’t seem I can get it to work correctly.

    I found it was not the ampersand (&) causing the problem but a forward-slash (/) I had one in my page title and it did not like that and is what generated the error I posted above. So, it would be nice to have it handle the forward-slash (/), really most all characters would be good.

    However, there still seems to be something wrong/not working. I removed the forward-slash from my page title, and that got rid of the error. But, my menu bar still shows the long page title.

    I did see and filled in the ‘Alternative Link Text’ box with my short text, but it’s not showing that.

    BTW this is exactly what I was looking for and you did a great job on the plugin. Good placement of the Alternative Link Text box, fits in nicely.

    Thread Starter theMaab

    (@themaab)

    Technokinetics : after reading iridiax post again, I thought that would be a cool thing to have in this is a custom link title too. Good thinking

    Thanks for the help with this.

    I can replicate the problem with special characters, and will see what I can do about that.

    Other than that, the plugin works fine on the two sites that I’ve used for testing. Could you point me to yours so that I can see what’s still going wrong? Thanks.

    Oh yes, adding a custom title attribute option in a later version will be straightforward enough; will add that to the to-do list.

    Okay, the version currently available for download (v0.2) can cope with titles including & or /.

    Alternative title attribute support added in v0.3.

    N.B. If you just overwrite the old alt-title-text.php file with the new then the alternative title attributes won’t work. The database column used to store alternative title attributes is created when the plugin is activated, so you’ll need to deactivate and reactivate the plugin.

    Thread Starter theMaab

    (@themaab)

    Hi Technokinetcs,

    I’ve got the new version of the plugin, got it installed and deactivated and re-activated.

    I thought it was still not working, but found it is.
    For some reason the page I kept trying, it didn’t like.

    I’ve now tried other pages and everything works for it beautifully. It takes the long page title, but uses the shorter version for the link, and the link title works great too!

    I’m not sure why that one page doesn’t work. I bet if i delete that page and recreate it, it will work fine, which is what I’ll do.

    The site hasn’t ‘launched’ yet, so it wont’ cause a problem. Using seo friendly urls anyways, so can make the new page match the old.

    Thanks for the great plugin! Sorry to have caused more work with my weird problem.

    Please email me at ‘james’ ‘mm’ at ‘gmail’ and I’ll send a link to you for the site.

    Thanks again!

    Thread Starter theMaab

    (@themaab)

    Well, it seems the new plugin is not working.

    I ran into some other pages where it kept using the page title.
    And then I’ve found it also looses the values for the Link Text and Title Text. Seems at random, at least I can’t tell what causes it to loose them.

    On a separate note I’d still like you to contact me to talk about something else I’ve been wanting to do recently.

    Thanks

    Hi James,

    I can’t recreate the problems you’re seeing, but the point of testing is to pick up on issues that arise with different site setups; this is all very useful.

    I’ll be in touch so that I can find out what the specifics are, and fix any bugs before I make this more widely available.

    Will post back here when the plugin is ready for general release to wrap up this thread.

    Tim

    Hi,
    I’ve recently tried the plugin with WP 2.6.1 and WPMU 2.6. In WPMU it doesn’t supply anything to the editor interface, and in WP it does actually provide the wee box for the alternate link, but then doesn’t use whatever you put in there.

    Any ideas?

    Would be great to see this one work well, I used to use the stub instead of the title to form navigation buttons, rewriting myself a copy of wp_list_pages. This has stopped working, and its not really a solution if you intend to keep upgrading WP.

    thanks for the effort

    Hi Nibb,

    Please drop me an email (tim at technokinetics.com) with a link to your site (and preferably an admin login) and I’ll take a look.

    The plugin works absolutely fine on some sites (including James’s now). Hopefully we can work out what’s different about your WP installation that I haven’t taken account of, and get this resolved so that more people can use the plugin.

    Thanks,

    Tim

    The one known issue with this plugin (where a title to be replaced contains a special character such as “&” or “/” no replacement of any titles takes place) has been resolved in v0.4, which is now available for download.

    If anyone is having problems that aren’t fixed by switching to v0.4, then I’d really appreciate an email (to tim @ technokinetics .com) explaining what isn’t working.

    If I don’t hear from anyone in the next few days, then I’ll make a v1.0 available in the www.remarpro.com Plugin Directory. Thanks to all who have helped with this.

    Tim

Viewing 15 replies - 1 through 15 (of 21 total)
  • The topic ‘Change link text from wp_list_pages, instead of using page titles’ is closed to new replies.