• i am using the both these functions into my post but its not working.
    I want to insert page id into

    <a>">
    any solution? please help
    <?php get_page_link($id); ?>
    <?php get_the_premalink($id); ?></a>
Viewing 10 replies - 1 through 10 (of 10 total)
  • Those functions return the URL for you to use, they don’t output it by themselves.

    You need to use this:

    <?php echo get_the_permalink ($id); ?>

    Thread Starter jazzi.pissces

    (@jazzipissces)

    actually i already used that function as you have mentioned above, but still it is not working

    yes, but you are not using it the right way.

    You heed to use echo to output the link. The way that you had it won’t show anything which is why you aren’t seeing anything. The only function that outputs the URL by itself is the_permalink() which is meant ot work inside the loop.

    Thread Starter jazzi.pissces

    (@jazzipissces)

    well i used it with the echo but sill no effect what so ever, by the way i am using older version of wordpress, is this had to do something with that, the version is 3.6

    If you’re echoing it, the only thing that’s left is that you’re giving the function an invalid post ID so it can’t find anything to create the link for. If yo uare 100% sure that you have a valid post ID, then post your actual code here so we can see what’s going on with it.

    As far as the version goes, that shoudln’t matter as get_permalink() has been part of core sonce 1.0. But having said that, you shoudl be udpating to the lastest version if only for the security of it.

    Thread Starter jazzi.pissces

    (@jazzipissces)

    actually i checked again the code it is fine, the page is not displaying when i click view page from the wordpress admin, any solution?

    What do you mean by “not displaying”? Is there a “not found” message, an error page, a blank white screen, etc? There could be 1,000’s of things that are wrong there.

    Thread Starter jazzi.pissces

    (@jazzipissces)

    it is displaying a blank page

    Blank as in no content, or a plain white only screen?

    If it’s no content, then you’ll want ot find out what content is supposed to be there then track down the template file for that page and see why it’s not outputting.

    If it’s a purely white screen then you have a coding error somewhere. check your servers log files and set this in yoru wp-config.php file:

    define('WP_DEBUG', true);

    That will show any error messages and you’ll know what’s going wrong and where.

    Thread Starter jazzi.pissces

    (@jazzipissces)

    thank you so much, i will check it

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘how to insert page id into a href’ is closed to new replies.