I wrote my own custom page template for my Wordpress page, now I want to change sidebar.php to insert a small menu whenever that page template is loaded.
// sidebar.php
if ( isset($event_name) ) {
// do something
}
But apparently sidebar.php doesn't recognize variable $event_name.
How do I come about solving this?
While I'm not familiar with the way WordPress implements templates, have you tried declaring the variable global in the sidebar page?
See: Function Reference/is page template « WordPress Codex to be able to detect page template in use.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With