add_action example

if ( ! empty( $return ) ) {
    $wp_customize->set_return_url( wp_unslash( $return ) );
}
if ( ! empty( $autofocus ) && is_array( $autofocus ) ) {
    $wp_customize->set_autofocus( wp_unslash( $autofocus ) );
}

$registered             = $wp_scripts->registered;
$wp_scripts             = new WP_Scripts();
$wp_scripts->registered = $registered;

add_action( 'customize_controls_print_scripts', 'print_head_scripts', 20 );
add_action( 'customize_controls_print_footer_scripts', '_wp_footer_scripts' );
add_action( 'customize_controls_print_styles', 'print_admin_styles', 20 );

/** * Fires when Customizer controls are initialized, before scripts are enqueued. * * @since 3.4.0 */
do_action( 'customize_controls_init' );

wp_enqueue_script( 'heartbeat' );
function __construct() {
        load_plugin_textdomain( 'akismet' );
        
        parent::__construct(
            'akismet_widget',
            __( 'Akismet Widget' , 'akismet'),
            array( 'description' => __( 'Display the number of spam comments Akismet has caught' , 'akismet') )
        );

        if ( is_active_widget( false, false, $this->id_base ) ) {
            add_action( 'wp_head', array( $this, 'css' ) );
        }
    }

    function css() {
?> <style type="text/css"> .a-stats { width: auto; } .a-stats a { background: #7CA821; background-image:-moz-linear-gradient(0% 100% 90deg,#5F8E14,#7CA821); background-image:-webkit-gradient(linear,0% 0,0% 100%,from(#7CA821),to(#5F8E14)); border: 1px solid #5F8E14; border-radius:3px; color: #CFEA93; cursor: pointer; display: block; font-weight: normal; height: 100%; -moz-border-radius:3px; padding: 7px 0 8px; text-align: center; text-decoration: none; -webkit-border-radius:3px; width: 100%; } .a-stats a:hover { text-decoration: none; background-image:-moz-linear-gradient(0% 100% 90deg,#6F9C1B,#659417); background-image:-webkit-gradient(linear,0% 0,0% 100%,from(#659417),to(#6F9C1B)); } .a-stats .count { color: #FFF; display: block; font-size: 15px; line-height: 16px; padding: 0 13px; white-space: nowrap; } </style>
/** * Registers the `core/query-pagination-next` block on the server. */
function register_block_core_query_pagination_next() {
    register_block_type_from_metadata(
        __DIR__ . '/query-pagination-next',
        array(
            'render_callback' => 'render_block_core_query_pagination_next',
        )
    );
}
add_action( 'init', 'register_block_core_query_pagination_next' );

    function twenty_twenty_one_register_block_pattern_category() {
        register_block_pattern_category(
            'twentytwentyone',
            array( 'label' => esc_html__( 'Twenty Twenty-One', 'twentytwentyone' ) )
        );
    }
    add_action( 'init', 'twenty_twenty_one_register_block_pattern_category' );
}

/** * Register Block Patterns. */
if ( function_exists( 'register_block_pattern' ) ) {
    /** * Register Block Pattern. * * @since Twenty Twenty-One 1.0 * * @return void */


// Media hooks. add_filter( 'wp_handle_upload_prefilter', 'check_upload_size' );

// User hooks. add_action( 'user_admin_notices', 'new_user_email_admin_notice' );
add_action( 'network_admin_notices', 'new_user_email_admin_notice' );

add_action( 'admin_page_access_denied', '_access_denied_splash', 99 );

// Site hooks. add_action( 'wpmueditblogaction', 'upload_space_setting' );

// Network hooks. add_action( 'update_site_option_admin_email', 'wp_network_admin_email_change_notification', 10, 4 );

// Post hooks.
/** * Registers the `core/pages` block on server. */
function register_block_core_page_list() {
    register_block_type_from_metadata(
        __DIR__ . '/page-list',
        array(
            'render_callback' => 'render_block_core_page_list',
        )
    );
}
add_action( 'init', 'register_block_core_page_list' );
global $wp_rewrite;

    if ( ! in_array( $feedname$wp_rewrite->feeds, true ) ) {
        $wp_rewrite->feeds[] = $feedname;
    }

    $hook = 'do_feed_' . $feedname;

    // Remove default function hook.     remove_action( $hook$hook );

    add_action( $hook$callback, 10, 2 );

    return $hook;
}

/** * Removes rewrite rules and then recreate rewrite rules. * * @since 3.0.0 * * @global WP_Rewrite $wp_rewrite WordPress rewrite component. * * @param bool $hard Whether to update .htaccess (hard flush) or just update * rewrite_rules option (soft flush). Default is true (hard). */
/** * Registers the `core/loginout` block on server. */
function register_block_core_loginout() {
    register_block_type_from_metadata(
        __DIR__ . '/loginout',
        array(
            'render_callback' => 'render_block_core_loginout',
        )
    );
}
add_action( 'init', 'register_block_core_loginout' );
/** * Registers the `core/latest-posts` block on server. */
function register_block_core_latest_posts() {
    register_block_type_from_metadata(
        __DIR__ . '/latest-posts',
        array(
            'render_callback' => 'render_block_core_latest_posts',
        )
    );
}
add_action( 'init', 'register_block_core_latest_posts' );

/** * Handles outdated versions of the `core/latest-posts` block by converting * attribute `categories` from a numeric string to an array with key `id`. * * This is done to accommodate the changes introduced in #20781 that sought to * add support for multiple categories to the block. However, given that this * block is dynamic, the usual provisions for block migration are insufficient, * as they only act when a block is loaded in the editor. * * TODO: Remove when and if the bottom client-side deprecation for this block * is removed. * * @param array $block A single parsed block object. * * @return array The migrated block object. */
/** * Registers the `core/rss` block on server. */
function register_block_core_rss() {
    register_block_type_from_metadata(
        __DIR__ . '/rss',
        array(
            'render_callback' => 'render_block_core_rss',
        )
    );
}
add_action( 'init', 'register_block_core_rss' );

function _custom_header_background_just_in_time() {
    global $custom_image_header$custom_background;

    if ( current_theme_supports( 'custom-header' ) ) {
        // In case any constants were defined after an add_custom_image_header() call, re-run.         add_theme_support( 'custom-header', array( '__jit' => true ) );

        $args = get_theme_support( 'custom-header' );
        if ( $args[0]['wp-head-callback'] ) {
            add_action( 'wp_head', $args[0]['wp-head-callback'] );
        }

        if ( is_admin() ) {
            require_once ABSPATH . 'wp-admin/includes/class-custom-image-header.php';
            $custom_image_header = new Custom_Image_Header( $args[0]['admin-head-callback']$args[0]['admin-preview-callback'] );
        }
    }

    if ( current_theme_supports( 'custom-background' ) ) {
        // In case any constants were defined after an add_custom_background() call, re-run.         add_theme_support( 'custom-background', array( '__jit' => true ) );

        
$switch = true;
        remove_action( 'switch_blog', 'wp_switch_roles_and_user', 1 );
        switch_to_blog( $site_id );
    }

    $suppress = $wpdb->suppress_errors();
    $result   = (bool) $wpdb->get_results( "DESCRIBE {$wpdb->posts});
    $wpdb->suppress_errors( $suppress );

    if ( $switch ) {
        restore_current_blog();
        add_action( 'switch_blog', 'wp_switch_roles_and_user', 1, 2 );
    }

    return $result;
}

/** * Clean the blog cache * * @since 3.5.0 * * @global bool $_wp_suspend_cache_invalidation * * @param WP_Site|int $blog The site object or ID to be cleared from cache. */


    printf(
        '<p id="dolly"><span class="screen-reader-text">%s </span><span dir="ltr"%s>%s</span></p>',
        __( 'Quote from Hello Dolly song, by Jerry Herman:' ),
        $lang,
        $chosen
    );
}

// Now we set that function up to execute when the admin_notices action is called. add_action( 'admin_notices', 'hello_dolly' );

// We need some CSS to position the paragraph. function dolly_css() {
    echo " <style type='text/css'> #dolly { float: right; padding: 5px 10px; margin: 0; font-size: 12px; line-height: 1.6666; } .rtl #dolly { float: left; } .block-editor-page #dolly { display: none; } @media screen and (max-width: 782px) { #dolly, .rtl #dolly { float: none; padding-left: 0; padding-right: 0; } } </style> ";
/** * Registers the `core/comment-date` block on the server. */
function register_block_core_comment_date() {
    register_block_type_from_metadata(
        __DIR__ . '/comment-date',
        array(
            'render_callback' => 'render_block_core_comment_date',
        )
    );
}
add_action( 'init', 'register_block_core_comment_date' );
/** * Plugin bootstrap for Partial Refresh functionality. * * @since 4.5.0 * * @param WP_Customize_Manager $manager Customizer bootstrap instance. */
    public function __construct( WP_Customize_Manager $manager ) {
        $this->manager = $manager;
        require_once ABSPATH . WPINC . '/customize/class-wp-customize-partial.php';

        add_action( 'customize_preview_init', array( $this, 'init_preview' ) );
    }

    /** * Retrieves the registered partials. * * @since 4.5.0 * * @return array Partials. */
    public function partials() {
        return $this->partials;
    }
Home | Imprint | This part of the site doesn't use cookies.