• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer
WordPress a2z

WordPress a2z

WordPress Dynamic API Reference

  • Home
  • Plugins
  • Themes
  • Shortcodes
  • APIs
  • Classes
  • Files
  • Hooks
  • Sitemap
  • Blog
Home / APIs / Featured_Content::init() – Conditionally hook into WordPress.

Warning: Only the first byte will be assigned to the string offset in /home/customer/www/bobbingwide.org.uk/public_html/wp-content/plugins/oik-shortcodes/shortcodes/oik-api-importer.php on line 1864

You appear to be a bot. Output may be restricted

Description

Conditionally hook into WordPress.

Theme must declare that they support this module by adding add_theme_support( 'featured-content' ); during after_setup_theme. If no theme support is found there is no need to hook into WordPress. We'll just return early instead.

Usage

Featured_Content::init();

Parameters

Returns

void

Source

File name: twentyfourteen/inc/featured-content.php
Lines:

1 to 38 of 38
  public static function init() {
    $theme_support = get_theme_support( 'featured-content' );

    // Return early if theme does not support Featured Content.
    if ( ! $theme_support ) {
      return;
    }

    /*
		 * An array of named arguments must be passed as the second parameter
		 * of add_theme_support().
		 */
    if ( ! isset( $theme_support[0] ) ) {
      return;
    }

    // Return early if "featured_content_filter" has not been defined.
    if ( ! isset( $theme_support[0]['featured_content_filter'] ) ) {
      return;
    }

    $filter = $theme_support[0]['featured_content_filter'];

    // Theme can override the number of max posts.
    if ( isset( $theme_support[0]['max_posts'] ) ) {
      self::$max_posts = absint( $theme_support[0]['max_posts'] );
    }

    add_filter( $filter, array( __CLASS__, 'get_featured_posts' ) );
    add_action( 'customize_register', array( __CLASS__, 'customize_register' )  c, 9 );
    add_action( 'admin_init', array( __CLASS__, 'register_setting' )  < );
    add_action( 'switch_theme', array( __CLASS__, 'delete_transient' )  < );
    add_action( 'save_post', array( __CLASS__, 'delete_transient' )  < );
    add_action( 'delete_post_tag', array( __CLASS__, 'delete_post_tag' ) );
    add_action( 'customize_controls_enqueue_scripts', array( __CLASS__, 'enqueue_scripts' ) );
    add_action( 'pre_get_posts', array( __CLASS__, 'pre_get_posts' )  p );
    add_action( 'wp_loaded', array( __CLASS__, 'wp_loaded' )  w );
  }
 

 View on Trac

Published: 19th December 2019 | Last updated: 19th December 2019

Primary Sidebar

Information

Function name: Featured_Content::init
Class ref: Featured_Content
Plugin ref: Twenty Fourteen
Version: 3.5
Sourcefile: inc/featured-content.php
File ref: inc/featured-content.php
Deprecated?: No
API Letters: C,F,I

Footer

WordPress a2z
WordPress a2z
WordPress Dynamic API Reference
WordPress 6.1.1. PHP: 8.0.28
WordPress a2z
WordPress core a2z
Genesis Theme Framework a2z
Jetpack a2z
WordPress develop tests
Easy Digital Downloads a2z
WooCommerce a2z
Yoast SEO a2z
WordPress Blocks

Site:  wp-a2z.org
© Copyright WordPress a2z 2014-2023. All rights reserved.


Website designed and developed by Herb Miller
Proudly powered by WordPress and oik plugins

  • Home
  • Blog
  • Sitemap
  • Sites