Needed a slight mod to work for posts
-
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.
- The topic ‘Needed a slight mod to work for posts’ is closed to new replies.