I am trying to get the postID from a postSlug. Thought I could use “query_posts” to do this. I don get what is happening as I get content in the pageArray, but putting the following code int the template fails to print anything for “about_PageID”. I tried adding “setup_postdata”, but no joy. Any ideas?
$pageArray = query_posts('pagename=about'); //retrieves the about page only
$about_PageID = $pageArray->ID]
echo "Page ID: " . $about_PageID;
- The topic ‘Php function: $pageID from slug?’ is closed to new replies.