php - Unable to get page name in wordpress -
i customizing wordpress plugin used popup email subscribing. when user submits email gets confirmation email in iam sending custom html him. have 5 different pages on web site , every page has popup. iam doing want name of page according want send html in email. did same thing other plugin , worked in popup plugin iam unable page name called. have tried following things failed.
global $post; /* worked perfect on other plugin */ $pagename = $post->post_name; if($pagename=="page1") { // html page1 // } else { // html page2 // }
just tried this
$slug = basename(get_permalink()); if($slug=="page1") , on
here go, need title
this, as
$post = get_post( $post ); $pagename = isset( $post->post_title ) ? $post->post_title : '';
hope helps.
Comments
Post a Comment