plugin-icon

Sectors – Conditional Templates & Hooks

What if you could add templates, actions, and filters depending on the context?
평가
최근 업데이트일
September 1, 2020
버전
1.2
활성화된 설치 항목
10
Sectors – Conditional Templates & Hooks

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 )
무료Creator 요금제에서
활성화된 설치 항목
10
테스트된 버전
5.5.15
이 플러그인은 다운로드 가능하며 워드프레스 독립 호스트 설치에 사용할 수 있습니다.