=== Header Footer Builder – Custom Header and Footer for WordPress ===
Contributors: tazeenehsan
Tags: header footer, custom header, custom footer, header builder, footer builder
Requires at least: 5.5
Tested up to: 6.8
Requires PHP: 7.4
Stable tag: 1.0.2
License: GPLv3
License URI: http://www.gnu.org/licenses/gpl-3.0.html

Build beautiful custom headers and footers with powerful display conditions. Show different headers or footers on specific pages, posts, archives, 404, WooCommerce pages, and more.

== Description ==

**Header Footer Builder** is a lightweight yet powerful plugin that lets you design fully custom headers and footers for your WordPress site — and precisely control where each one appears using flexible display conditions.

Unlike other header footer plugins, every template comes with a built-in **include/exclude rule system**. You can show a unique header on your homepage, a different one on WooCommerce shop pages, and hide the footer entirely on landing pages — all without writing a single line of code.

=== Key Features ===

* **Unlimited templates** — Create as many header and footer templates as you need.
* **Display conditions** — Show or hide templates based on:
  * Entire site
  * Front page, blog index page
  * Specific pages or posts (search and select by name)
  * All posts, all pages, all custom post types
  * Category archives, tag archives, all archive pages
  * Author archive pages
  * Search results pages
  * 404 pages
  * WooCommerce shop, product, cart, checkout, my account pages
* **Include & exclude rules** — Include a template sitewide and exclude it from specific pages, or vice versa.
* **Priority-based matching** — More specific rules always win. A rule targeting a specific page beats a rule targeting all pages, which beats a sitewide rule.
* **Works with any page builder** — Use the native WordPress block editor (Gutenberg), Elementor, or any other builder to design your templates.
* **Theme compatibility** — Works with popular themes including Astra, GeneratePress, OceanWP, Kadence, Hello Elementor, and more.
* **Zero bloat** — No external dependencies or heavy frameworks. Fast and standards-compliant.
* **Developer friendly** — Clean OOP PHP, PSR-style autoloading, React-based admin UI, REST API-powered.

=== How Display Conditions Work ===

1. Create a header or footer template in the builder.
2. Click **Conditions** next to any template.
3. Add **Include Rules** to define where the template should appear.
4. Add **Exclude Rules** to carve out exceptions.
5. Save — the template is now live with smart targeting.

Rules are priority-scored: specific page/post targets score highest, followed by post-type rules, then archive rules, then the sitewide catch-all. The highest-scoring matching template wins.

=== Perfect For ===

* Landing pages that need no header or footer
* WooCommerce stores with checkout-specific headers
* Blogs with a different header for category archive pages
* Membership sites with role-specific navigation
* Multipage sites that need per-section branding

== Installation ==

1. Upload the plugin files to the `/wp-content/plugins/ultimate-header-footer` directory, or install the plugin directly through the WordPress Plugins dashboard.
2. Activate the plugin through the **Plugins** menu in WordPress.
3. Navigate to **Header Footer** in your WordPress admin sidebar to start creating templates.
4. Click **Add New** to create your first header or footer template.
5. Once the template is designed, click **Conditions** to configure where it should appear.

== Frequently Asked Questions ==

= Does this plugin work with Elementor? =
Yes. You can use Elementor (or any page builder) to design the content of your header and footer templates. The plugin handles the display logic.

= Does it work with the WordPress block editor (Gutenberg)? =
Yes. Templates are standard WordPress custom posts, so Gutenberg works out of the box.

= Can I create different headers for different pages? =
Absolutely. Create multiple header templates and assign each one a different set of display conditions. The plugin automatically picks the best-matching template for each page load.

= What happens if two templates match the same page? =
The plugin uses a priority scoring system. More specific rules win: a rule targeting a specific page beats a rule targeting all pages, which beats a sitewide rule. If two templates have equal priority, the most recently published one is used.

= Can I exclude a template from certain pages? =
Yes. Each template supports both include and exclude rules. Exclude rules always override include rules, so you can include a template sitewide and then exclude it from specific pages.

= Does it support WooCommerce pages? =
Yes. You can target the WooCommerce shop page, single product pages, cart, checkout, and my account pages using dedicated display condition rules.

= Will it slow down my site? =
No. Template matching is done efficiently in PHP with a single database query per page load. There are no external API calls or heavy scripts on the frontend.

= Which themes are supported? =
The plugin is designed to work with themes that support custom header/footer regions. Tested with Astra, GeneratePress, OceanWP, Kadence, and Hello Elementor.

= Can developers hook into the template selection logic? =
Yes. The selection logic is fully OOP and hookable. See the source code for the ConditionsMatcher class.

= Is there multisite/network support? =
The plugin works on individual WordPress sites. Multisite/network-wide configuration is not yet supported.

== Screenshots ==

1. Dashboard listing all header and footer templates with status and condition badges.
2. Display conditions modal showing include and exclude rules.
3. Specific page/post selector with live search inside the conditions modal.
4. Template builder screen using the native WordPress block editor.

== Changelog ==

= 1.0.2 =
* Added display conditions system with include/exclude rules
* Priority-based template matching engine
* Smart specifics search for pages, posts, categories, and tags
* Conditions badge in dashboard showing rule counts
* Improved dashboard UI with type badges and publish/unpublish controls
* Fixed sanitization of condition rules in REST API

= 1.0.1 =
* Submission feedback fix

= 1.0.0 =
* Initial release
* Basic header/footer template builder

== Upgrade Notice ==

= 1.0.2 =
Adds powerful display conditions with include/exclude rules. Upgrade recommended for all users.