the_permalink()
is a loop function, it's made for use "in the loop".
If you have a non-standard loop, you can just as easily use...
echo get_permalink($ID);
where $ID is a variable where you're storing the ID for the "current" page/post in your custom loop or you can again use this with a single entry, just as long as you pass the ID into the fucntion.Revisions
- October 8, 2013 @ 05:59:31 [Current Revision] by PeterLugg
- October 8, 2013 @ 05:59:31 by PeterLugg
- June 26, 2013 @ 01:25:00 by PeterLugg
- June 26, 2013 @ 01:23:02 by PeterLugg
Revision Differences
June 26, 2013 @ 01:23:02 | Current Revision | ||
---|---|---|---|
Content | |||
Added: Wisdom taken from here: <a href="http:// wordpress.org/ support/topic/ how-to-get-the-url-of-the- page-you-are- on-with-php" target="_blank" >http://wordpress.org/support/ topic/how-to- get-the-url- of-the-page-you- are-on-with-php</a> | |||
Deleted: | Added: [php] | ||
Added: echo "http://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; | |||
Added: [/php] | |||
Added: If you are in the WordPress loop: | |||
Added: Yes it will work for lists of posts, providing they use a regular loop.. | |||
Added: <code>the_permalink( )</code> is a loop function, it's made for use "in the loop". | |||
Added: If you have a non-standard loop, you can just as easily use... | |||
Added: <code>echo get_permalink( $ID);</code> where $ID is a variable where you're storing the ID for the "current" page/post in your custom loop or you can again use this with a single entry, just as long as you pass the ID into the fucntion. |
Note: Spaces may be added to comparison text to allow better line wrapping.
No comments yet.