• Resolved jonesy17

    (@jonesy17)


    I’m loading a single post based on its permalink and am trying to capture the post ID to use in some PHP/mySQL magic that will create a link to go in the header.php file. Before anyone tells me to RTFM, here’s what I’ve tried (based on searches of the forums):
    if (is_single($postID)) {...
    $postID = get_the_ID();
    $postID = $wp_query->post->ID;
    From everything I can see, it seems none of these work. Now, it is quite possible I’m hooking into the wrong activation hook in the add_action function, but I’ve tried several including get_header, init, wp and wp_head with no success either.
    As I said, I’ve searched the forums for an answer already, and while I’ve seen similar questions it seems the responders have failed to realize that the post ID is to be used in the header.
    Can anyone help me out with this?

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Use post ID to create a link for use in header.php’ is closed to new replies.