skromta
Member
Posted 1 month ago #
This is probably a really stupid question that I should know the answer to but ...
How do I link to another page/post on the same blog? Yes I know that I could write Bla but this mean that the link will stop working if I change domain (yep, it recently happened to me). How can I link in a way that is "domain independent"?
bloginfo('url').'/<pagename> or get_bloginfo('url').'/<pagename>
skromta
Member
Posted 1 month ago #
Hmmm, can I use that directly in a post (from what I understand I can't)?
So I should write a simple plugin to do this? Or am I missing something?
Oh... you want to write this inside a post. Sorry. No you can't insert PHP using the editor.
Though I've never used them before I think I'd cook up a shortcode to do this if it were me. Maybe there is a default shortcode for the purpose. I'm not sure. At any rate, it should be a simple function to write.
You can do it by using links like so..
/?p=ID
or
/wordpress-directory/?p=ID
..depending where WP is installed.
Where ID is the ID for the post, this ensures it will work regardless of your permalink settings, because the ?p=ID will always resolve to the correct post..
skromta
Member
Posted 3 weeks ago #
Thanks, a small plugin made it work as I wanted.
Do you mind telling us what the plugin was?
skromta
Member
Posted 3 weeks ago #
Ohh, just something that I hacked together myself
I like this one personally(having just searched)...
http://wordpress.org/extend/plugins/link-to-post/
No need to know a post or pages ID. Works in both visual and HTML modes..
I was going to write a basic one, but there's no need when a decent one exists.. :)
Or if you want a more simple one, there's also this.
http://wordpress.org/extend/plugins/easy-post-to-post-links/
skromta
Member
Posted 3 weeks ago #
The first one doesn't solve my problem, it generates a full anchor-tag which is what I wanted to avoid, the second on the other hand works more or less the same way as mine.
But ... I'm going to take a closer look at the code for the first one and see if I have the time to take a few ideas from there to improve mine (easier entering the id). Thanks.