WordPress.org

Ready to get started?Download WordPress

Forums

Dynamic linking to the current web page regardless of type (4 posts)

  1. joelwalsh
    Member
    Posted 9 years ago #

    In my header I would like to dynamically provide an "email this web page" link using the script below. The problem is passing the id tag for each and every web page. Right now I am trying to do conditional tags for each kind of web page in wordpress. However, I am having trouble finding all the URL formats and also I think this might be overkill. What to do?

    /email.php?
    <?php
    if {
    is_home()
    echo ""
    the_ID());
    }
    elseif {
    is_single()
    echo "p="
    the_ID());
    }
    elseif {
    is_category()
    echo "cat="
    the_ID());
    }
    elseif {
    is_page()
    echo "page_id="
    the_ID());
    }
    }
    elseif {
    is_author()
    echo "aut_id"
    the_ID());
    }
    ?>"

  2. lynk
    Member
    Posted 9 years ago #

    You need the url of the current page?

    something like

    <?php
    echo 'http://www.joelwalsh.com'.$_SERVER['REQUEST_URI'];
    ?>

  3. joelwalsh
    Member
    Posted 9 years ago #

    Thanks--one question before I try this: will this just return the Permalink? Because I don't think the permalink will work with passing the id value through to the next form...the form is an email this post thing based on the one in the blue radiance theme that works by grabbing the unique id for the preceding web page and then pulling the data from the server based on it.

  4. lynk
    Member
    Posted 9 years ago #

    this would give the permalink

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags