Latest Version: 2.1.2
Works on: From version 2.5+
Last Update: 27th January 2014

Update Log

1.1 – I realised you couldn't remove a label or attribute value once it had been set. This has now been rectified.
1.2 – Have now combined the two boxes into one section. It now appears at the top of the Advanced Options.
1.3 – Fixed an issue with version 1.2
1.4 – Minor fixes plus stripping out the added backslashes
1.5 – There is no 1.5 really, I just messed up the SVN update in the WP repository for version 1.4!
1.6 – Added in a migration function to allow you to migrate your settings over to the new All in one SEO pack plugin (if you use it) as it now uses the same code.
1.7 – Set the plugin priority to 1 as certain other menu plugins are getting their changes in first and preventing the plugin working.
1.8 – Some error fixes
1.9 – Couple of minor fixes to remove error messages showing for some.
1.9.1 – Fixed the insufficient priviledges error showing for some. Added in a couple of tags for the title attribute to replicate either the page title or menu label.
2.0 – Finally have managed to get this working with the link_before and link_after parameters, which means anyone with additional tags (such as <span> tags) within the link to make it easier for using images shouldn't find their tags being stripped out now. Also tidied up the admin on the add/edit Page.
2.0.1 – Had to revert some of the code to fix an issue that 2.0 caused with menus and child menus.
2.0.2 – Fixed the code to work with the link_before and link_after tags.
2.0.3 – Minor bug fix where the link to the settings page was wrong (only showed up for All in One SEO pack users).
2.0.4 – Minor bug fix to remove some HTML comments that caused layout issues in MSIE.
2.0.5 – Upgraded to work with WP 3.3 which not longer contains title attributes by default.
2.1 – Rewritten the code to make it more efficient and flexible, added in an All in One SEO pack import option.
2.1.1 – Bug fixes on migration and errors showing.
2.1.2 – Bug fixes (thanks to Mark Anderson for the pointers)

The Plugin

The Page Menu Editor allows you to customise the menu label and title attribute of any Page link that's being displayed with the Template Tag wp_list_pages(). Originally, by default WordPress gave the title attribute of any page link the same text as the anchor text and I felt there was no point repeating the same text, it's a complete waste of time in my opinion. You should only use a title attribute on a link if you need to expand on the already given anchor text e.g. If the anchor text is 'Home' then you could have the title attribute as 'Return to our Front Page'. Since WordPress 3.3, this has been removed and there is no title attribute by default.

This plugin allows you to have a different menu label to the page header (by default both are usually the same) and add a title attribute for any page you want to, and if you don't then no title attribute will be set. It's mainly been written for sites using WordPress as a CMS however can still be useful to anyone who has one or more pages on their site that are displayed using the wp_list_pages() tag.

For an example of the title attribute, hover your mouse over my pages above, 'Learn PHP' should display a tool tip of 'Reference Guide to PHP Tutorials on StuffBySarah'.

Instructions

  1. Download the Plugin and unzip it.
  2. Upload it to your plugins directory and activate it via the Plugins section.
  3. Go into Manage – Pages and edit an existing page OR go to Write – Page. Below the content area you'll see two new boxes – Page Menu Label and Page Link Title Attribute See Figure 1.
  4. Fill this out with the text you require and Save or Publish the page.
Figure 1: Page Link Title Attribute Form Box
Page Menu Editor Screenshot
Figure 2: Title Attribute Showing on Link Hover
Title Attribute Screenshot

It's a pretty simple plugin and at present there are no options as I can't really think of any to offer! Any requests please leave them in the comments below and if I can I'll add them in. Any problems also leave them below.

  • Sarah Comments:

    I believe I've finally got a working copy of the plugin to work with single line and nested menus with link_before and link_after in use. I, however, need some testers to check it for me. If you would like to try the new version and test it please contact me and I'll email you a copy.

    Thank you to anyone who offers! :)

  • Aidan Comments:

    Good day, I have used your plugin on a previous site and it works great.
    I have loaded the plugin today on a new site and it does not work. When I want to go to the settings section it gives me this:

    "You do not have sufficient permissions to access this page."

    I tried to reinstall the plugin yet i still get the same problem. I have the latest wordpress installed. Is there anything I can do? I am not a coder so do not want to fiddle with the php to get my desired result.

    I have all in one SEO pack installed, does that create this problem? If so can you reccomend another way for me to change the title of a page without it affecting the navigation label.

    • Sarah Comments:

      Hi Aidan, ah you've helped me find a bug. I've fixed that on my own copy and will upload a fixed version shortly. With regards to your question, you don't need this plugin with the All in one SEO pack, as it uses this plugin's code within it (and one therefore overrides the other).

      If you create a page and then scroll down to the all in one SEO pack options, you should see a form allowing you to set the page title, meta description, meta keywords, the menu label and the title attribute. You can set the page title to be extra long and keyword rich, and you can set the menu (ie. navigation) label to be short but still relevant.

      Personally I am now moving over to using Joost de Valk's WordPress SEO plugin, as it has more features, and WordPress's own custom menus, which removes the need for my plugin or any version of it :-)

  • Alex Comments:

    Does line 26 of the plugin need to be there? Or can it be commented out in php? It's generating commented lists of items in the rendered page that IE can render as white space. Plugins and themes that also add classes to the body tag end up with those commented items in the body class list as well sometimes.

  • Razvan Neagu Comments:

    Sarah,

    Would you clarify something for me? You say above that using WP native custom menus removes the need for the plugin. How is that?

    The reason I use your plugin is so various page navigation widgets in the sidebar show the shorter page label. These widgets show dynamic list of pages (e.g. all children of page ID#…). My understanding is that I can set page labels with WP custom menus but that is only for pre-built menus, not for dynamic lists of pages… right?

    Another place I have long Page Titles displayed is in the breadcrumb navigation. Unfortunately the theme I am using does not show the shorter Page Menu Label (as I think it should).

    Do you have any idea of what type of PHP edit I would need to do to the breadcrumbs code (theme uses "Breadcrumbs Plus" code)? Is the Page Menu Label a "standard" WP variable, so I would just need to find/replace the Page Title variable with the Page Menu Label variable?

    I appreciate it if you could point me in the right direction.

    Thanks!

    • Sarah Comments:

      Hi Razvan. My point about the custom menus is for creating menus via Appearance -> Menus. I can understand if you want to generate dynamic child menus of the specific page, although another option (which we've used on a couple of sites) is to create the child menu and then just do a bit of an if (is_page(ID)) load menu X elseif (is_page(ID2)) load menu Y etc. This means that it's still easy to control the menus (obviously this is designed for a fairly static top level menu).

      However, if you need completely dynamic menus then yes, you still need to rely on wp_list_pages() and therefore if you need to amend the anchor text for these links you'll still need the plugin. Sorry, I'll update the post to clarify this a bit better :)

      With regards to your breadcrumb navigation, unless you can get the plugin editor to perhaps work with my plugin, and maybe check for a page label before using the page title/heading, then it won't automatically pick up on it as it's a custom field. I'll try and get a chance to take a look at the breadcrumbs plugin and if it's a quick fix I can update it to work for you. Then you're welcome to forward it to the plugin developer to see if they'll release it with their own code :)

  • Michael Atkins Comments:

    Hi Sarah

    I've been looking at WordPress v3.3 beta 2 and it seems that the Page Menu Editor plugin no longer modifies the Menu Label on that version of WP – at least not on my local test site in which it did work with WP v3.21

    • Michael Atkins Comments:

      I made a thread on the beta forum at WordPress.org at: http://wordpress.org/support/t.....v33-beta-2

      One of the thread replies was:
      The plugin is using a regex to modify the links produced by wp_list_pages(). Part of the regex pattern looks for title="([^\"]+)" however in WP 3.3b2 the title attribute has been left out of the links (in the Walker_Page class), and therefore the plugin's regex is not able to match.

      • Sarah Comments:

        Hi Michael, thanks for your comments and the info. Apologies I didn't reply sooner as I've been away and then ill. I'll get onto fixing the plugin before 3.3 is released, hopefully on the weekend if not sooner. Sounds like a quick fix :)

      • Sarah Comments:

        Hi Michael, this is now fixed and updated. You should see a plugin update through on your WP admin within the next few hours. Thanks again for letting me know :)

  • Michael Atkins Comments:

    Hi Sarah! Great news. I look forward to trying it out. Thanks

  • carl thompson Comments:

    Hello Sarah,

    I'm using WP version 3.3.1. I've installed the Page Menu Editor plugin and migrated the info for my All-In-One SEO plugin.

    I have a long page title (Halloween Costumes & Accessories) and want the menu label to be "Halloween." I'm not sure what I'm doing wrong but it doesn't work. The menu label still the long title.

    I went into the page to be modified, scrolled to the bottom. The info I've entered into the Page Menu Editor is as follows:

    Page Menu Label: Halloween
    Page Link Title Attribute: Halloween Costumes & Accessories

    Then I scrolled to the top of the page and clicked on "Update."

    I'm sure the error is on my end but I just don't know what I'm doing wrong.

    I'm not sure what I'm supposed to do with this line in the Page Menu Editor: (Use %%pagetitle%% to use the page title or %%menulabel%% to use the menu label). Does this get entered someplace?

    Thx in advance for your support.

    cthompson

    • Sarah Comments:

      Hi Carl, a quick look at your source code tells me you're using the built in WordPress custom menus. If so then you can set your anchor text and title attributes in there and you don't need the page menu editor for those. It only works where/when you use wp_list_pages().

      With regards to the %%pagetitle%% and %%menulabel%% these are just a way to automatically include the page title or the menu label into the content. Eg. if you had a page with the title of just 'Company' and you wanted the title attribute to be 'About Company' then you could use 'About %%pagetitle%%' which means when you update your page title your title attribute would automatically pick it up too. It was just a feature requested by someone and could be handy for some.

      Hope that helps! :)

  • rowatt Comments:

    Hi Sarah,

    The update to 2.1 is causing all sorts of problems for me. I get lots of PHP notices (undefined offset) and the plugin ignores all my previous customisations to page menu title.

    I've rolled back to 2.0.5 for now and everything is OK.

    The notices seem to come from when $pgmenueditor in line 55 is empty (ie nothing defined for that page), and looking at your code it seems that you changed the post_meta key from 2.05 to 2.1, which would explain why my old customisations disappeared.

    mark.

    • Sarah Comments:

      Hi Rowatt, sounds like the migration function didn't kick in for you as it should check what version you're upgrading from and if it's below 2.1 then migrate your titles and attributes over to the new storage method. Possibly it just didn't kick in for you. If you want to try again and if it still doesn't work drop me a message via my contact form. If you're happy to give me a temp login (I'd need DB access too) then I'll go in and take a look to see what's going on and why it's not working for you :)

      However, from a functionality point of view, there isn't a lot of difference between 2.05 and 2.1. I just rewrote the whole plugin to be more future proof and use more efficient code, so if you're happy as you are then there's no security risk staying on that version, but I'm happy to help you if you do want to upgrade :)

  • Matt Comments:

    Hello,

    I first used the plugin WP title 2, but that didn't work anymore after upgrading to WP 3.3

    With the help of a friend I found this plugin and I must say its just great and does exactly what I want.

    Regards,
    Matt

  • Ray Blakley Comments:

    Hello Sarah,

    I added your Page Editor plugin to the afore mentioned website for a friend. When I assigned the home page (stagnant) the Title went away. My friend bought a 3rd party template and I'm not exactly sure if that is part of the problem. I found some posts online that offered a fix to the coding on the "general-template.php" in wp_title function and made the following recommended repair:

    if ( is_single() ( is_page() && !is_front_page() ) ) {

    delete "&& !is_front_page()"

    This didn't mess anything up, but the headline for the home page still doesn't appear.

    Any ideas? Thanks in advance for any help!

    Take Care,
    Ray

    • Sarah Comments:

      Hi Ray,

      I'm not sure if my plugin has anything to do with the problem you've mentioned. The Page Menu editor just edits the anchor text and title attribute text in the page menu. It should affect the page title. Have you got another plugin to edit the titles eg. the WordPress SEO plugin? If you're not sure then I would recommend deactivating all plugins, enable my one and check things work as they should (anchor links/title attributes rewritten in the menu but nothing else affected) and then re-enable the other plugins one at a time to see if anything causes problems.

      I'm also not sure if your code above is broken by the comment system but it shouldn't really work if it's as you typed it. You probably need an OR (or || ) after the is_single() otherwise that's incorrect syntax as far as I'm aware.

      PS. Sorry for the delay in replying. I'm recovering from a broken arm so things are slow at present.

  • Emma Comments:

    Hi Sarah
    Sorry to be such a technophobe but I wonder if I could get you to look at my site.
    I have a report which I wish to break down into 120 recommendations hand have the facility to comment under each individual recommendation.
    I want to use a fresh page to keep it seperate from my every day blog.
    Would your plug in do this?
    Really appreciate your advice.
    Thanks
    Emma

    • Sarah Comments:

      Hi Emma, My plugin just allows you to set the text that you see for a page in the page menu, nothing more. By the sounds of it you just want to either set up a section of pages with comments available, a new post category solely for the recommendations that you exclude from your main site, or, if you have the ability, set up a custom post type and create a new post per recommendation. The latter would be more logical, but if you're not sure of how to set up custom post types and integrate them into your site then you'll probably find creating a new page section the easiest. However I would recommend looking into custom post types if you fancy a challenge, and get it set up using those :)

  • Matt Comments:

    Hey Sarah, thank you for this perfect plugin. One question though. Is it also possible to get the page_menu_label inside my functions.php? For example: I have multiple pages where the title is rather long, but the page-menu-title (provided by your plugin) is short. E.g. the_title is "About me, myself and other relevant me's" and the page-menu-title is just "About". This is exactly what I want so my navigation shows only "About". However I query all page-titles in a custom function inside my functions.php like this …

    $pages = get_pages();
    foreach ( $pages as $page ) { $html .= $page->post_title;

    Is there any chance to query the page-menu-title if it exists? For now this custom function of course returns the long actual page-titles but I want to get the menu-titles which are set by your plugin. Any idea how I could do that?

  • Matt Comments:

    Hey Sarah,

    Thank you for the lovely plugin. When using the standard "wp_list_pages()" function all the page-titles are listed just fine. Just as I'd expect it. Do you have any idea how I can make $pages = get_pages(); work with your plugin as well? When using get_pages() and then querying the title via $page->post_title I of course get the long page titles and not the ones set with your plugin. Any idea how I can query the the page-title set with your plugin?

    • Sarah Comments:

      Hi Matt, sorry I don't think I replied to your comment. Do you still need the code for this?

      • Matt Comments:

        Hey Sarah, Yeah, I'd love to find a solution for this. Any ideas?

      • Sarah Comments:

        Hi Matt, okay the following will get you the label used. This uses the page ID and then grabs the correct post meta data and pulls out the label (as it's stored as a serialised array).

        $pgmenueditor = get_post_meta($page->ID, 'dsa_pagemenueditor');
        $menu_label = stripslashes($pgmenueditor[0]['menu_label']);

        you can then use $menu_label as the variable to show the shortened title.

        Let me know if that's what you needed and works for you :)

      • matt Comments:

        Thank you perfect!!!

  • James Edel Comments:

    Good day Sarah, I need to update to WP 3.5. Have you have any reported issues with your plugin?

    Thanks!

    • Sarah Comments:

      Hi James, apologies for the delay in response. No I've not had any issues reported so far. I have got an update to roll out, I just need to finish testing and unfortunately it's a jam packed month this month! However the current version should be fine :-)

  • Peter Comments:

    Thank you for this usefull plugin!
    I found an minor bug. When I turn on WP debugging, all menu items titles that are altered with page menu editor display a message "undefined offset 0 in line 56 (and 57) in page-menu-editor.php

    • Sarah Comments:

      Thanks Peter, I'll look into what's causing the error

      • Anna Comments:

        Hi Sarah, Great plugin! Just wanted to let you know I get the same undefined offset warning. I get it where I insert my own submenu script:

        Notice: Undefined offset: 0 in /server/www/path/website.nl/httpdocs/wp-content/plugins/page-menu-editor/page-menu-editor.php on line 57.

        I get this exact message a whole bunch of times.
        Now as I'm far from a decent programmer, so this is without a doubt related to my own funky script, but I just thought i'd let you know. I don't get any other errors in debug mode.

  • Sarah Comments:

    Just to let people know, a new update will fix the debug error appearing on line 57. Sorry for the delays, been a hectic time.

  • Leave a Reply

    Your email address will not be published. Required fields are marked *