Using Page Titles as Conditions in If Menu
-
Albeit simple and a bit heavy handed,I was able to edit the conditions.php file to compare to page titles by:
$conditions[] = array( 'name' => __( 'Page is Products', 'if-menu' ), 'condition' => 'if_menu_is_products_page' );
and adding the corresponding function:
/* Jammer added */ function if_menu_is_products_page() { return is_page('Products'); }
the above code works if you want to ONLY show an item when on that page, to show an item when not on that page I used the following Condition and function (once again probably not as elegant as it could be):
$conditions[] = array( 'name' => __( 'Page is NOT Products', 'if-menu' ), 'condition' => 'if_menu_is__NOT_products_page' );
function if_menu_is__NOT_products_page() { if (is_page('Products') == false) return true; return false;
While this seems to work ok, it does require editing the conditions.php file for each and every page title you want to add.
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Using Page Titles as Conditions in If Menu’ is closed to new replies.