Support » Fixing WordPress » the_permalink() for Pages with templates

  • the_permalink() and get_permalink($id) both output for Pages with templates. For example, see my links page. At the bottom you’ll find the output of the_permalink().

    I can easily code a function to generate the correct URI if there isn’t one already. My question is, is there one?

    Update: Gee, it’s been ten minutes, no answer from Podz… I’m digging into the core now…

    Update: $id doesn’t get set for templated Pages…

Viewing 2 replies - 1 through 2 (of 2 total)
  • Solution:
    global $wp_query;
    $id = $wp_query->post->ID;
    $uri = get_settings('siteurl') . '/' . get_page_uri($id) . '/';

    The templates in question had no loops. A call to the_loop() in the template would fix it.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘the_permalink() for Pages with templates’ is closed to new replies.