WordPress.org

Ready to get started?Download WordPress

Forums

the_permalink() for Pages with templates (3 posts)

  1. skeltoac
    Member
    Posted 9 years ago #

    the_permalink() and get_permalink($id) both output http://www.skeltoac.com/2005/04/20// 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...

  2. skeltoac
    Member
    Posted 9 years ago #

    Solution:
    global $wp_query;
    $id = $wp_query->post->ID;
    $uri = get_settings('siteurl') . '/' . get_page_uri($id) . '/';

  3. skeltoac
    Member
    Posted 9 years ago #

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

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.