Cannot get post ID
-
Topic
-
Hi,
I am attempting to disable the menu for certain pages and added the following code to my child themes functions.php
function themeblvd_custom_menu_content() { //echo $requested_page; //Code for custom landing page menue will go here } /* Remove all other actions and add in our custom function */ function themeblvd_custom_menu() { $id = get_the_ID(); if ($id == 16961) { remove_all_actions( 'themeblvd_header_menu' ); // Remove all other actions add_action( 'themeblvd_header_menu', 'themeblvd_custom_menu_content' ); // Add our custom function } } /* Hook everything in after theme has been loaded */ add_action( 'after_setup_theme', 'themeblvd_custom_menu' );
For some reason the ID of the page is not available in function themeblvd_custom_menu() but is in function themeblvd_custom_menu_content(). I have verified this by echoing the id in both functions.
I have spent hours trying to resolve and searched for answers without success.
Any help appreciated.
Thanks
Mark
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The forum ‘Swagger Responsive WordPress Theme’ is closed to new topics and replies.