Alert: This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.

WP_Internal_Pointers::print_js() WordPress Method

The WP_Internal_Pointers::print_js() method is used to print JavaScript code to display internal pointers.

WP_Internal_Pointers::print_js( string $pointer_id, string $selector, array $args ) #

Print the pointer JavaScript data.


Parameters

$pointer_id

(string)(Required)The pointer ID.

$selector

(string)(Required)The HTML elements, on which the pointer should be attached.

$args

(array)(Required)Arguments to be passed to the pointer JS (see wp-pointer.js).


Top ↑

Source

File: wp-admin/includes/class-wp-internal-pointers.php

114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
private static function print_js( $pointer_id, $selector, $args ) {
    if ( empty( $pointer_id ) || empty( $selector ) || empty( $args ) || empty( $args['content'] ) ) {
        return;
    }
 
    ?>
    <script type="text/javascript">
    (function($){
        var options = <?php echo wp_json_encode( $args ); ?>, setup;
 
        if ( ! options )
            return;
 
        options = $.extend( options, {
            close: function() {
                $.post( ajaxurl, {
                    pointer: '<?php echo $pointer_id; ?>',
                    action: 'dismiss-wp-pointer'
                });
            }
        });
 
        setup = function() {
            $('<?php echo $selector; ?>').first().pointer( options ).pointer('open');
        };
 
        if ( options.position && options.position.defer_loading )
            $(window).bind( 'load.wp-pointers', setup );
        else
            $( function() {
                setup();
            } );
 
    })( jQuery );
    </script>
    <?php
}


Top ↑

Changelog

Changelog
VersionDescription
3.3.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by the Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.