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

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -