I am using the below code to display my next and previous links in single.php:
<div class="nav-previous"><?php previous_post_link( '%link', '<img height="34" src="' . get_bloginfo("template_directory") . '/images/previous.png" />' ); ?></div>
<div class="nav-next"><?php next_post_link( '%link', '<img height="34" src="' . get_bloginfo("template_directory") . '/images/next.png" />' ); ?></div>
Everything is working well except that I am defining some rewrite rules in my websites so I am not using the default links like:
http://local-host/enc/?aya-bi-aya=aya-143
but instead
http://local-host/enc/aya-bi-aya/aya-143/
I managed to change the structures of my links for all the website except for the next and previous links, since it requires maybe change of core code!!
How can I customize the urls returned by these two Wordpress functions?
Thanks for your time and consideration.
Edit:
I am using custom post type(=aya-bi-aya).My permalink structure is set to default. It then displays my permalinks like:
http://local-host/enc/?aya-bi-aya=aya-143
But inside my website, I dont need such urls, but instead I am using urls like:
http://local-host/enc/?aya-bi-aya=aya-143&assurah=al-baqarah&attab=attakhrij
The additional parameters fulfill my needs, especially in my jquery code. Plus, I am using the mod_rewrite to tranform my links to:
http://local-host/enc/aya-bi-aya/al-baqarah/aya-143/attakhrij/
The only remaining thing is to change the links in previous and next, so that they respect this last shape.
Thanks Milo for triggering the real issue.
get_permalink
to output the links, how are you outputting the correct links for single posts? are these a custom post type? if you correctly filterpost_link
orpost_type_link
to format your URLs, this problem will disappear, but I have a feeling you've gone about the whole thing in a strange way to end up where you are now. – Milo Aug 28 '13 at 18:15post_link
andpost_type_link
. thanks – whiteletters in blankpapers Aug 28 '13 at 18:41