WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Alternative title in page, slug, menu (5 posts)

  1. Leah
    Member
    Posted 1 year ago #

    I would like to create a page with:
    - Enter title here = This is my about page
    - the page name in pages listing = About
    - the slug = about
    - the page name in menu = About
    - the title when viewing the page = This is my about page

    How?

  2. alieneila
    Member
    Posted 1 year ago #

    Without using a plugin you can do most of the above...

    First, create a page with just the title "About" and publish it. This will create the page with the slug /about/ and then change the title. Or create the page with whatever title you want and edit the slug to be just /about/.

    If you use WordPress's menu system to create your menu, you add the page to the menu, then expand the options of that item in the menu and change the Label to be About.

    The only place where the actual title instead of About will show up is in a listing of pages. For that you need to search for a plugin.

  3. Leah
    Member
    Posted 1 year ago #

    Thanks, and yep it wont work for the page listings. And I really wanted it the other way around for the user. Have the same page title in write mode as when displaying the page.

    Perhaps better to find a plugin for a alternative title text area in write mode and have that displayed in the template?

  4. alieneila
    Member
    Posted 1 year ago #

    Yeah probably your best bet, there are a lot of SEO plugins that offer alternate titles. That or you can use WordPress's built in Custom Fields (might have to turn it on under Screen Options, top right corner of an edit post or edit page screen), add one with a field name like... custom_title and set the value to what you want it. Then you could use something like...

    $custom_title = get_post_meta($post->ID, 'custom_title', true);
    echo '<h1>' . $custom_title . '</h1>';

    in your template.

    Or create a filter for the_title and add it to functions.php

    add_filter('the_title','my_custom_title');
    function my_custom_title( $title ) {
         global $post;
         if (get_post_meta($post->ID, 'custom_title', true) != '')
              return get_post_meta($post->ID, 'custom_title', true);
         else
              return $title;
    }
  5. Leah
    Member
    Posted 1 year ago #

    ok, thanks for your help!

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags