Template_Handler implements Registerable

This class handles the template display for a protected category or taxonomy archive, and for single posts which belong to a protected category.

Depending on the level of protection, a password login form or 404 page will be displayed.

Tags
author

Barn2 Plugins support@barn2.co.uk

license

GPL-3.0

copyright

Barn2 Media Ltd

Interfaces, Classes and Traits

Registerable

Table of Contents

__protect_templates()  : mixed
Protects single and taxonomy templates if they are password protected or private.
body_class_private_category()  : array<string|int, mixed>
Add class to the body tag.
body_class_protected_category()  : array<string|int, mixed>
Add class to the body tag.
meta_robots_noindex_head()  : mixed
register()  : mixed
get_login_url_with_current_page_redirect()  : void
Get login url.
get_spoofed_post()  : mixed
handle_404()  : void
Generic method to set a page status to 404.
handle_password_protected_category()  : mixed
handle_private_category()  : void
Set page status to 404 on private cats.
handle_user_protection()  : void
Determine how to handle the protection when a user login is required.
prevent_caching()  : mixed
prevent_indexing()  : mixed

Methods

__protect_templates()

Protects single and taxonomy templates if they are password protected or private.

public __protect_templates() : mixed

Should run after Password_Form::handle_login() which may have set the passowrd cookie.

Tags
global

WP $wp Main WP instance

global

WP_Query $wp_query The main query

Return values
mixed

body_class_private_category()

Add class to the body tag.

public body_class_private_category(array<string|int, mixed> $classes) : array<string|int, mixed>
Parameters
$classes : array<string|int, mixed>
Return values
array<string|int, mixed>

body_class_protected_category()

Add class to the body tag.

public body_class_protected_category(array<string|int, mixed> $classes) : array<string|int, mixed>
Parameters
$classes : array<string|int, mixed>
Return values
array<string|int, mixed>

meta_robots_noindex_head()

public meta_robots_noindex_head() : mixed
Return values
mixed

get_login_url_with_current_page_redirect()

Get login url.

private get_login_url_with_current_page_redirect() : void
Return values
void

get_spoofed_post()

private get_spoofed_post() : mixed
Return values
mixed

handle_404()

Generic method to set a page status to 404.

private handle_404() : void
Return values
void

handle_password_protected_category()

private handle_password_protected_category() : mixed
Return values
mixed

handle_private_category()

Set page status to 404 on private cats.

private handle_private_category() : void
Return values
void

handle_user_protection()

Determine how to handle the protection when a user login is required.

private handle_user_protection() : void
Return values
void

prevent_caching()

private prevent_caching() : mixed
Return values
mixed

prevent_indexing()

private prevent_indexing() : mixed
Return values
mixed

Search results