WordPress.org

Support

Support » How-To and Troubleshooting » Returning page urls

Returning page urls

  • I created the code below which works as expected on my test environment, but not in the wordpress.com live site (I have a VIP account). Would differing url structures throw it all off? Also, the date returns the wrong month (both test and live env). I’m passing data from the blog into variables.

    if (is_home() && is_paged() == 0) { <–this seems fine
    echo ‘var name=”Blog:Home”;’;
    echo ‘var prop=”Home”;’;
    }
    elseif (is_paged() >= 1) {
    echo ‘var name=”Blog:’ . get_page_link($page_id) . ‘”;’; <–oddly, this returns the first permalink
    echo ‘var prop=”Browse”;’;
    }
    elseif (is_author()) { <–this seems fine
    echo ‘var name=”Blog:’ . $mm_auth . ‘”;’;
    echo ‘var prop=”‘ . $mm_auth . ‘”;’;
    }
    elseif (is_single()) { <–this seems fine
    echo ‘var name=”Blog:’ . $author . ‘:’ . $post->post_title . ‘”;’;
    echo ‘var prop=”‘ . $author . ‘”;’;
    }
    elseif (is_search()) { <–this seems fine
    echo ‘var name=”Blog:Search:’ . $search . ‘”;’;
    echo ‘var prop=”Search”;’;
    }
    elseif (is_month()) {
    $month = get_month_link(”,”);
    echo ‘var name=”Blog:’ . $month . ‘”;’; <–this returns wrong month url
    echo ‘var prop=”Browse”;’;
    }
    else { ; }

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Returning page urls’ is closed to new replies.
Skip to toolbar