View Categories

Hooks & Filters

9 min read

Complete reference of every action hook, filter hook, and shortcode registered by the Sinematik theme. All hooks are catalogued from functions.php, inc/customizer.php, and inc/portfolio.php.


Action Hooks #

Theme Setup #

Hook Callback File Line Priority Description
after_setup_theme sinematik_setup functions.php 20 10 Core theme setup: registers theme supports, nav menus, image sizes, content width, translation files, and comment callback.
after_setup_theme sinematik_starter_content functions.php 1045 10 Registers starter content for the Customizer (demo pages, posts, nav menus, widgets, theme mods).
init sinematik_register_block_patterns functions.php 577 10 Registers the sinematik block pattern category and auto-discovers patterns from the /patterns/ directory.
init sinematik_register_cpts functions.php 1427 10 Registers custom post types: testimonial and faq. Both gated behind Customizer toggle settings.
init sinematik_register_portfolio_cpt inc/portfolio.php 19 10 Registers the sinematik_portfolio custom post type with public archive, REST support, and portfolio slug.
init sinematik_register_portfolio_taxonomy inc/portfolio.php 79 10 Registers the portfolio_category hierarchical taxonomy for the sinematik_portfolio CPT.

Asset Enqueueing #

Hook Callback File Line Priority Description
wp_enqueue_scripts sinematik_scripts functions.php 163 10 Enqueues all frontend assets: main stylesheet, fonts, Tailwind CSS, Font Awesome, Three.js (conditional), WooCommerce styles, blog layout styles, header variants, comment-reply script, theme JS, and front-page JS.
enqueue_block_editor_assets sinematik_editor_custom_colors functions.php 78 10 Injects Customizer color variables (primary, secondary, accent) into the block editor via inline CSS.
wp_enqueue_scripts sinematik_google_fonts inc/customizer.php 984 10 Enqueues local font CSS (Inter, JetBrains Mono) based on Customizer typography settings.

Head Output #

Hook Callback File Line Priority Description
wp_head sinematik_resource_hints functions.php 294 1 Outputs <link rel="preload"> for local WOFF2 fonts, DNS prefetch for external resources, theme color meta, and favicon fallback.
wp_head sinematik_preload_lcp_image functions.php 328 1 Outputs <link rel="preload" as="image"> for the featured image on singular posts (LCP optimization).
wp_head sinematik_social_meta functions.php 475 5 Outputs Open Graph and Twitter Card meta tags. Dynamically uses post title, excerpt, and featured image on singular pages.
wp_head sinematik_typography_css inc/customizer.php 1026 10 Outputs inline CSS for Customizer typography settings (font family, font size, line height) as CSS custom properties.
wp_head sinematik_color_variables inc/customizer.php 1063 10 Outputs inline CSS for Customizer color settings (primary, secondary, accent) as :root CSS custom properties.
wp_head sinematik_schema_jsonld functions.php 1272 99 Outputs JSON-LD structured data: Organization, WebSite (with SearchAction), and BlogPosting (on single posts). Gated by Customizer toggle.

Security & Performance #

Hook Callback File Priority Description
wp_head sinematik_resource_hints inc/performance.php 1 Preloads local WOFF2 fonts, DNS prefetch, theme-color meta, favicon fallback.
wp_head sinematik_preload_lcp_image inc/performance.php 1 Preloads featured image on singular posts (LCP optimization).
send_headers sinematik_security_headers inc/performance.php 10 Sends HTTP security headers (X-Content-Type-Options, X-Frame-Options, CSP, etc.).
template_redirect sinematik_maintenance_mode inc/performance.php 10 503 maintenance mode for non-admin visitors. Customizer toggle.
wp_default_scripts sinematik_remove_jquery_migrate inc/performance.php 10 Removes jquery-migrate dependency from jQuery on frontend.
robots_txt sinematik_robots_txt inc/performance.php 10 Custom virtual robots.txt with sitemap reference.
the_content sinematik_lazy_images inc/performance.php 99 Adds loading="lazy" + decoding="async" to content images. First image gets fetchpriority="high".
login_enqueue_scripts sinematik_login_styles inc/performance.php 10 Custom login page styles.
login_head sinematik_login_css_vars inc/performance.php 10 Theme color variables on login page.
init sinematik_register_block_styles inc/block-styles.php 10 Registers 6 Gutenberg block style variants (Glass button, Glass quote, Gradient separator, etc.).
wp_body_open sinematik_cookie_banner inc/admin-extras.php 10 Renders cookie consent banner (Customizer toggle, cookie check).

Widgets #

Hook Callback File Line Priority Description
widgets_init sinematik_widgets_init functions.php 542 10 Registers 5 widget areas: sidebar-1 (Blog Sidebar) and footer-1 through footer-4 (Footer Columns).
widgets_init sinematik_register_widgets functions.php 728 10 Registers custom widgets: Sinematik_About_Widget, Sinematik_Social_Widget, Sinematik_CTA_Widget.

Contact Form #

Hook Callback File Line Priority Description
admin_post_sinematik_contact_form sinematik_handle_contact_form functions.php 767 10 Processes authenticated contact form submissions: nonce verification, honeypot check, rate limiting, sanitization, and email delivery.
admin_post_nopriv_sinematik_contact_form sinematik_handle_contact_form functions.php 768 10 Processes unauthenticated (guest) contact form submissions with the same security checks.

Admin #

Hook Callback File Line Priority Description
admin_head sinematik_admin_notice_styles functions.php 1150 10 Injects activation notice styles only on themes.php?activated=1.
admin_notices sinematik_activation_notice functions.php 1175 10 Displays theme activation notice with links to Customizer, Menus, Widgets, and TGMPA plugin installation.
customize_register sinematik_customizer_register inc/customizer.php 86 10 Registers all Customizer sections, settings, and controls for the theme.
customize_preview_init sinematik_customizer_preview_js inc/customizer.php 970 10 Enqueues the Customizer preview JavaScript for live updates.

Login Page #

Hook Callback File Line Priority Description
login_enqueue_scripts sinematik_login_styles functions.php 1222 10 Enqueues custom login page stylesheet and overrides the login logo with the theme custom logo.
login_head sinematik_login_css_vars functions.php 1256 10 Outputs CSS custom properties for primary and secondary colors on the login page.

Filter Hooks #

Content Processing #

Hook Callback File Line Priority Args Description
the_content sinematik_toc functions.php 655 10 1 ($content) Auto-generates a Table of Contents from H2/H3 headings in single posts. Adds anchor IDs and inserts TOC HTML before the first heading. Requires minimum 3 headings. Gated by Customizer toggle.
the_content sinematik_lazy_images functions.php 614 99 1 ($content) Adds loading="lazy" and decoding="async" to content images. First image gets fetchpriority="high" instead. Skips SVGs and tiny images.

Excerpt #

Hook Callback File Line Priority Args Description
excerpt_length sinematik_excerpt_length functions.php 754 10 1 ($length) Overrides excerpt word count. Reads from Customizer setting sinematik_excerpt_length, defaults to 25.
excerpt_more sinematik_excerpt_more functions.php 759 10 1 ($more) Replaces default excerpt “more” suffix with ....

Body Classes #

Hook Callback File Line Priority Args Description
body_class sinematik_header_body_classes functions.php 1025 10 1 ($classes) Adds sinematik-sticky-header or sinematik-smart-sticky body class based on the Customizer header behavior setting.

Images & Media #

Hook Callback File Line Priority Args Description
jpeg_quality (closure) functions.php 109 10 1 ($quality) Sets JPEG compression quality to 82 for optimal quality/file-size balance.
avatar_defaults sinematik_custom_avatar functions.php 154 10 1 ($avatars) Adds a custom gradient avatar option (avatar.svg) to the default avatars list.

Security #

Hook Callback File Line Priority Args Description
the_generator __return_empty_string functions.php 352 10 1 ($generator) Removes the WordPress version from HTML and feed generator meta tags.
style_loader_src sinematik_remove_version_query functions.php 355 9999 1 ($url) Removes ver= query parameter from enqueued stylesheet URLs.
script_loader_src sinematik_remove_version_query functions.php 356 9999 1 ($url) Removes ver= query parameter from enqueued script URLs.
login_errors (closure) functions.php 365 10 1 ($errors) Replaces login error messages with a generic string to prevent information leakage.
login_display_language_dropdown __return_false functions.php 370 10 1 ($display) Hides the language switcher on the login page.
tiny_mce_plugins sinematik_disable_emoji_tinymce functions.php 400 10 1 ($plugins) Removes the wpemoji plugin from TinyMCE as part of emoji script removal.
xmlrpc_enabled __return_false functions.php 449 10 1 ($enabled) Disables XML-RPC to prevent brute-force attacks.

SEO & Robots #

Hook Callback File Line Priority Args Description
robots_txt sinematik_robots_txt functions.php 514 10 2 ($output, $public) Customizes robots.txt output: disallows wp-admin, wp-includes, cache, trackback, search. Allows admin-ajax.php and uploads. Adds sitemap reference.

Login Page Filters #

Hook Callback File Line Priority Args Description
login_headerurl sinematik_login_logo_url functions.php 1245 10 1 ($url) Changes the login logo link to point to the site home URL instead of wordpress.org.
login_headertext sinematik_login_logo_title functions.php 1250 10 1 ($title) Changes the login logo title attribute to the site name.

Admin #

Hook Callback File Line Priority Args Description
admin_footer_text sinematik_admin_footer functions.php 1210 10 1 ($text) Replaces the admin footer text with “Thank you for creating with WordPress. Theme: Sinematik.”

Shortcodes #

Shortcode Callback File Line Attributes Description
[sinematik_button] sinematik_shortcode_button functions.php 1375 href (default #), style (primary/outline/accent), class Renders a styled button link.
[sinematik_card] sinematik_shortcode_card functions.php 1402 title, icon (FA class), class Renders a glass-morphism card with optional icon and title.
[sinematik_alert] sinematik_shortcode_alert functions.php 1470 type (info/success/warning/error) Renders a colored alert box with icon.
[sinematik_tabs] sinematik_shortcode_tabs functions.php 1501 tab1tab4 (labels) Renders a tabbed interface with up to 4 tabs using inner [tabN] shortcodes.

Removed WordPress Core Hooks #

The following WordPress core hooks are explicitly removed by the theme for security and performance:

Hook Removed Action/Filter File Line Reason
wp_head wp_generator functions.php 351 Hide WP version
wp_head rsd_link functions.php 385 Remove Really Simple Discovery link
wp_head wlwmanifest_link functions.php 386 Remove Windows Live Writer link
wp_head wp_shortlink_wp_head functions.php 387 Remove shortlink tag
wp_head rest_output_link_wp_head functions.php 388 Remove REST API discovery link
wp_head wp_oembed_add_discovery_links functions.php 389 Remove oEmbed discovery
wp_head wp_oembed_add_host_js functions.php 390 Remove oEmbed host JS
wp_head print_emoji_detection_script (priority 7) functions.php 393 Remove emoji scripts
admin_print_scripts print_emoji_detection_script functions.php 394 Remove admin emoji scripts
wp_print_styles print_emoji_styles functions.php 395 Remove emoji styles
admin_print_styles print_emoji_styles functions.php 396 Remove admin emoji styles
the_content_feed wp_staticize_emoji functions.php 397 Remove feed emoji conversion
comment_text_rss wp_staticize_emoji functions.php 398 Remove comment feed emoji conversion
wp_mail wp_staticize_emoji_for_email functions.php 399 Remove email emoji conversion
wp_head feed_links (priority 2) functions.php 452 Remove RSS feed links (feeds still work)
wp_head feed_links_extra (priority 3) functions.php 453 Remove extra RSS feed links

Usage Examples #

Removing a Theme Action #

To disable a specific theme feature, use remove_action with the matching hook, callback, and priority:

// Disable Three.js particle background (load your own instead)
remove_action( 'wp_enqueue_scripts', 'sinematik_scripts' );

// Disable schema JSON-LD output
remove_action( 'wp_head', 'sinematik_schema_jsonld', 99 );

// Disable maintenance mode
remove_action( 'template_redirect', 'sinematik_maintenance_mode' );

// Disable TOC generation
remove_filter( 'the_content', 'sinematik_toc', 10 );

// Disable lazy image enhancements
remove_filter( 'the_content', 'sinematik_lazy_images', 99 );

// Disable Open Graph / Twitter Card meta
remove_action( 'wp_head', 'sinematik_social_meta', 5 );

Adding Custom Body Classes #

add_filter( 'body_class', function( array $classes ): array {
    if ( is_page( 'pricing' ) ) {
        $classes[] = 'pricing-page';
    }
    return $classes;
} );

Modifying the robots.txt Output #

add_filter( 'robots_txt', function( string $output, string $public ): string {
    // Add a custom disallow rule
    $output .= "Disallow: /private/\n";
    return $output;
}, 20, 2 );

Customizing Excerpt Length at Runtime #

// Override excerpt length for specific contexts
add_filter( 'excerpt_length', function( int $length ): int {
    if ( is_search() ) {
        return 15;
    }
    return $length;
} );

Adding Content After the TOC #

// The TOC filter runs at priority 10, lazy images at 99.
// To inject content before the TOC processes, hook earlier:
add_filter( 'the_content', function( string $content ): string {
    if ( is_singular( 'post' ) ) {
        $custom = '<div class="post-notice">Premium content ahead.</div>';
        return $custom . $content;
    }
    return $content;
}, 5 );

Disabling Security Headers (e.g., for development) #

remove_action( 'send_headers', 'sinematik_security_headers' );

Customizing the Login Page #

// Override the login logo URL
add_filter( 'login_headerurl', function(): string {
    return 'https://example.com/custom-page/';
} );

// Add custom login page CSS
add_action( 'login_enqueue_scripts', function(): void {
    wp_add_inline_style( 'sinematik-login', '.login h1 a { width: 200px !important; }' );
} );

Hook Execution Order Reference #

For developers extending the theme, here is the typical execution order of Sinematik hooks during a frontend page load:

  1. after_setup_themesinematik_setup (line 20) + sinematik_starter_content (line 1045)
  2. initsinematik_register_block_patterns (line 577) + sinematik_register_cpts (line 1427) + sinematik_register_portfolio_cpt (portfolio.php:19) + sinematik_register_portfolio_taxonomy (portfolio.php:79)
  3. widgets_initsinematik_widgets_init (line 542) + sinematik_register_widgets (line 728)
  4. wp_enqueue_scriptssinematik_scripts (line 163) + sinematik_google_fonts (customizer.php:984)
  5. send_headerssinematik_security_headers (line 373)
  6. wp_head (in priority order):
  7. Priority 1: sinematik_resource_hints (line 294) + sinematik_preload_lcp_image (line 328)
  8. Priority 5: sinematik_social_meta (line 475)
  9. Priority 10: sinematik_typography_css (customizer.php:1026) + sinematik_color_variables (customizer.php:1063)
  10. Priority 99: sinematik_schema_jsonld (line 1272)
  11. template_redirectsinematik_maintenance_mode (line 411)
  12. the_content (in priority order):
  13. Priority 10: sinematik_toc (line 655)
  14. Priority 99: sinematik_lazy_images (line 614)
  15. wp_footersinematik_deregister_embed (line 467)
Scroll to Top