[resolved] wp_list_pages and custom fields (7 posts)

  1. micasuh
    Posted 5 years ago #

    I have a use for wp_list_pages that's a little unconventional.

    For a page, I have a long Title that's optimized for SEO. I want to link to this page on the home.php page, but I want that link to say something different than the optimized title. Why? Because I wanna shorten it.

    Here's an example.

    Page Slug: http://example.com/nurses
    Page Title: Nurses know medicine and will protect your health
    Link on home.php: Nurses and Medicine

    So, in essence, I'd like to call a custom field to display "Nurses and Medicine" on the homepage using the wp_list_pages tag. If I display this page elsewhere using wp_list_pages, it would be the normal "Nurses know medicine and will protect your health" title.

    Is this possible?

    The only other thing I'd be interested to know is if it's possible to link to an exact part of the page, such as http://example.com/nurses#medicine using wp_list_pages.

  2. MichaelH
    Posted 5 years ago #

    You need to look at Function_Reference/get_pages and Custom Fields.

  3. micasuh
    Posted 5 years ago #

    I looked at those but don't have a clear idea of how to use those to work for me. Is what I'm describing not possible with using wp_list_pages?

  4. groovenectar
    Posted 5 years ago #

    Is this the functionality you're looking for?

  5. SpankMarvin
    Posted 5 years ago #

    Would it not make more sense to do this the other way around? Make the title of your page the short version, add a custom field for SEO title, and then incorporate the custom field as replacement for the page's title in the page template?

  6. debora vaisman
    Posted 5 years ago #

    I think that it is possible that you are going in the right direction.

  7. micasuh
    Posted 4 years ago #

    In short, I used the code on this post, modified it for my needs, and it basically works as I need it to.

Topic Closed

This topic has been closed to new replies.

About this Topic