• This seems to still work on WP 4.2.4. pagetitle links to a such-titled page and other display text links to such-titled page while displaying other text.

    However the original description of the plugin is I think wrong when it says it allows such type links to “posts and pages.” As coded, it looks only for Pages, not for Posts.

    I modified the code to look instead only for Posts, not for Pages. I will be using only Posts for these types of links, so that’s good for me. If you need to use such type links that will link to any Page or Post with such title, you would need to do some more extensive re-coding, I think.

    The change I made is very simple. Look for this code …

    if ( $page = get_page_by_title(html_entity_decode($link, ENT_QUOTES))</blockquote>

    … and change it to this:

    if ( $page = get_page_by_title(html_entity_decode($link, ENT_QUOTES),OBJECT,post)

    Cheers.

Viewing 1 replies (of 1 total)
  • Thread Starter warnerta

    (@warnerta)

    PS: Oops. This site also automatically converts double-bracketed text into links. So my post may not be readable. I meant:

    This seems to still work on WP 4.2.4. Double-bracketed text links to a such-titled page and using “|” works to display text different from the link, just like Wikipedia markup.

    However the original description of the plugin is I think wrong when it says it allows such type links to “posts and pages.” As coded, it looks only for Pages, not for Posts.

    I modified the code to look instead only for Posts, not for Pages. I will be using only Posts for these types of links, so that’s good for me. If you need to use double-bracketed links that will link to any Page or Post with such title, you would need to do some more extensive re-coding, I think.

Viewing 1 replies (of 1 total)
  • The topic ‘Needed a slight mod to work for posts’ is closed to new replies.