Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • jeanloui

    (@jeanloui)

    Thanks, t3, I will read carefully the codex directive, I’m a beginner, and you’re a GREAT Moderator!!!

    Thank you for your time!

    jeanloui

    (@jeanloui)

    the_permalink() into the loop (e.g. archive.php of any theme) gives something like this:

    http://example.com/?p=124

    If I need to “insert” extra variables after the ID, e.g.:
    http://example.com/?p=124&mycategory=3&myclient=john
    I use this:

    $myurl = get_post($post, ARRAY_N);

    // this gives a numeric array of the class object, where $myurl[0] contains the ID of the post, even if we don’t know if it is a “post” or a “page”, but all my items are “posts”… and maybe $myurl[20] defines if it is a post or a page…

    Then I write manually the new url:

    <a href="?p=<? echo $myurl[0]; ?>&mycategory=<? echo $mycategory ?>&myclient=<? echo $myclient ?>">New URL</a>

    Note that after the <a href, there is only the question mark.

    hope this helps

Viewing 2 replies - 1 through 2 (of 2 total)