Title: Sectors &#8211; Conditional Templates &amp; Hooks
Author: Joachim Jensen
Published: <strong>5 febrewaris, 2018</strong>
Last modified: 28 july, 2024

---

Search plugins

![](https://ps.w.org/sectors/assets/banner-772x250.png?rev=2064763)

Dizze plugin **is net hifke mei de lêste 3 grutte releases fan WordPress** . It 
kin net langer wurde ûnderhâlden of stipe en kin kompatibiliteitsproblemen hawwe
as it wurdt brûkt mei resinte ferzjes fan WordPress.

![](https://ps.w.org/sectors/assets/icon-256x256.png?rev=2064763)

# Sectors – Conditional Templates & Hooks

 Troch [Joachim Jensen](https://profiles.wordpress.org/intoxstudio/)

[Download](https://downloads.wordpress.org/plugin/sectors.zip)

 * [Details](https://fy.wordpress.org/plugins/sectors/#description)
 * [Resinsjes](https://fy.wordpress.org/plugins/sectors/#reviews)
 *  [Ynstallaasje](https://fy.wordpress.org/plugins/sectors/#installation)
 * [Ûntwikkeling](https://fy.wordpress.org/plugins/sectors/#developers)

 [Stypje](https://wordpress.org/support/plugin/sectors/)

## Beskriuwing

Sectors is a first of its kind plugin for WordPress. Create theme templates for 
any context on your site. Make sure select Actions or Filters are only added when
certain conditions are met.

#### Contexts

When you add a new sector to your site, you select the content it covers. This could
be:

 * All posts in a select category
 * Pages by an author
 * Custom Post Types with a Custom Taxonomy
 * …
 * Any combination of above

Sectors also comes with built in support for BuddyPress, WPML, Polylang, and more.

#### Templates

Sectors will look in your theme folder for the following templates:

 * `/sectors/<sector-name>.php`
 * `/sector-<sector-name>.php`

If found, it will be automatically loaded for the context.

#### API

**Template Tags**

Check if a query is part of a given or any sector:

    ```
    is_sector(string $sector):boolean
    ```

Get all sectors for current context:

    ```
    get_current_sectors():array
    ```

**Hooks**

Sectors extends all WordPress Actions and Filters by adding a scope. This means 
you can add a callback to an action and make sure it’s only executed in a given 
context:

    ```
    add_sector_action(string $sector, string $tag, callable $function, int $priority = 10, int $accepted_args = 1 )

    add_sector_filter(string $sector, string $tag, callable $function, int $priority = 10, int $accepted_args = 1 )
    ```

## Skermôfbyldings

 * [[
 * Actions & Filters without Sectors
 * [[
 * Actions & Filters using Sectors

## Ynstallaasje

 1. Upload the full plugin directory to your `/wp-content/plugins/` directory or install
    the plugin through `Plugins` in the Admin Dashboard
 2. Activate the plugin through `Plugins` in the Admin Dashboard
 3. Create your first Sector under the menu _Sectors > Add New_

## Resinsjes

D’r binne gjin resinsjes foar dizze plugin.

## Meiwurkers & amp; Untwikkelders

“Sectors – Conditional Templates & Hooks” is iepen boarne software. De folgjende
minsken hawwe bydroegen oan dizze plugin.

Meiwurkers

 *   [ Joachim Jensen ](https://profiles.wordpress.org/intoxstudio/)
 *   [ DEV Institute ](https://profiles.wordpress.org/devinstitute/)

[Oersette “Sectors – Conditional Templates & Hooks” yn jo taal.](https://translate.wordpress.org/projects/wp-plugins/sectors)

### Ynteressearre yn ûntwikkeling?

[Blêdzje troch de koade](https://plugins.trac.wordpress.org/browser/sectors/) , 
besjoch de [SVN-repository](https://plugins.svn.wordpress.org/sectors/) , of abonnearje
op it [ûntwikkelingslogboek](https://plugins.trac.wordpress.org/log/sectors/) troch
[RSS](https://plugins.trac.wordpress.org/log/sectors/?limit=100&mode=stop_on_copy&format=rss).

## Feroaringslog

#### 1.2

 * Added: wordpress 5.5 support
 * Added: minimum wordpress version 4.8
 * Added: minimum php version 5.6
 * Updated: wp-content-aware-engine
 * Updated: wp-db-updater

#### 1.1

 * Added: api to get current sectors
 * Added: ‘sector’ to body class
 * Added: ui improvements
 * Updated: wp-content-aware-engine

#### 1.0

 * Welcome

## Meta

 *  Version **1.2**
 *  Last updated **2 jier yn ôl**
 *  Active installations **10+**
 *  WordPress version ** 4.8 of heger **
 *  Tested up to **6.6.5**
 *  PHP version ** 5.6 of heger **
 *  Language
 * [English (US)](https://wordpress.org/plugins/sectors/)
 * Tags
 * [actions](https://fy.wordpress.org/plugins/tags/actions/)[filters](https://fy.wordpress.org/plugins/tags/filters/)
   [hooks](https://fy.wordpress.org/plugins/tags/hooks/)
 *  [Avansearre werjefte](https://fy.wordpress.org/plugins/sectors/advanced/)

## Wurdearrings

No reviews have been submitted yet.

[Your review](https://wordpress.org/support/plugin/sectors/reviews/#new-post)

[See all reviews](https://wordpress.org/support/plugin/sectors/reviews/)

## Meiwurkers

 *   [ Joachim Jensen ](https://profiles.wordpress.org/intoxstudio/)
 *   [ DEV Institute ](https://profiles.wordpress.org/devinstitute/)

## Stypje

Hast wat te sizzen? Help nedich hawwe?

 [Besjoch stipefoarum](https://wordpress.org/support/plugin/sectors/)