how to add php inside title code for admin bar menu.. please help..
-
How would you add a custom div and php inside title to display the custom menu?
for example, right now I have:
if ( $jrjm[jraba_jobroller_job_count] == 1 ) { $wp_admin_bar->add_menu( array('parent' => 'jobroller_job_links','id' => 'jobroller_job_count','title' => __('Job Count', 'jraba'), 'href' =>get_home_url( $blog->userblog_id, '/?s=&radius=1&location=' ) )); }
But I want to actualy show the count..
so what I was trying to do is:
if ( $jrjm[jraba_jobroller_job_count] == 1 ) { $wp_admin_bar->add_menu( array('parent' => 'jobroller_job_links','id' => 'jobroller_job_count','title' => __('<?php $count_pages = wp_count_posts('job_listing'); echo $count_pages->publish; ?> Jobs', 'jraba'), 'href' =>get_home_url( $blog->userblog_id, '/?s=&radius=1&location=' ) )); }
But it would give me an error: Parse error: syntax error, unexpected T_STRING in E:\wamp\www\wordpress\wp-content\plugins\jraba\menus\jraba-jobroller.php on line 285
Looking on line 285 it is the code I added
'title' => __('<?php $count_pages = wp_count_posts('job_listing'); echo $count_pages->publish; ?> Jobs', 'jraba'),
So how can I make this:
<?php $count_pages = wp_count_posts('job_listing'); echo $count_pages->publish; ?> Jobs
work inside this title code
work inside 'title' => __(' ');
- The topic ‘how to add php inside title code for admin bar menu.. please help..’ is closed to new replies.