Hi,
I have a common header in my hooks/header-extras.php and show it on some 20+ pages but I would like to remove it on just a couple of pages (i.e. not include header-extras on those selected pages). The pages are ones I've created in my hooks folder (a calendar page and GDPR policy page).
Obviously I don't want to create the same header using hooks for each individual page under hooks folder page.php and then not adding a header on the selective pages (although this would work), I'd rather continue to use header-extras (or footer-extras) to show the common header and add code? to the selected pages to not show/remove my header (header-extras.php).
Is there a quick, simple way, code to do this?
I presently get round it in an undesirable way by duplicating my header.php as header1.php edited to remove the last line:
<?php if(!defined('APPGINI_SETUP') && is_file(dirname(__FILE__) . '/hooks/header-extras.php')){ include(dirname(__FILE__).'/hooks/header-extras.php'); } ?>
I then point my 2 hooks/page.php files to the alternative header1.php by change to line:
include_once("../header.php"); to show include_once("../header1.php");
This works but I'm sure there's a simple more correct way!
Help appreciated, cheers, Ron
How to remove Header-extras on specific pages
How to remove Header-extras on specific pages
Ron - Gloucestershire, UK: AppGini Pro V 23.15 Rev 1484 - LOVING IT!
Plugins: Mass Update + Search Page Maker + Summary Reports + Calendar + Messages
Bizzworxx: AppGiniHelper + Inline Detail View
Alejandro Landini: To-Do List + MPI + TV Field Editor
Other: Udemy Course
Plugins: Mass Update + Search Page Maker + Summary Reports + Calendar + Messages
Bizzworxx: AppGiniHelper + Inline Detail View
Alejandro Landini: To-Do List + MPI + TV Field Editor
Other: Udemy Course
Re: How to remove Header-extras on specific pages
Hi ,
you could include in the header-extras.php a check against
$_SERVER['SCRIPT_FILENAME'];
which gives you the calling php (as I assume this happens). Then check for the pages you do not want and just exit.
you could include in the header-extras.php a check against
$_SERVER['SCRIPT_FILENAME'];
which gives you the calling php (as I assume this happens). Then check for the pages you do not want and just exit.
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.