Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/273.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何更改受保护函数div中的回显文本_Php_Wordpress_Woocommerce_Hook Woocommerce_Woocommerce Rest Api - Fatal编程技术网

Php 如何更改受保护函数div中的回显文本

Php 如何更改受保护函数div中的回显文本,php,wordpress,woocommerce,hook-woocommerce,woocommerce-rest-api,Php,Wordpress,Woocommerce,Hook Woocommerce,Woocommerce Rest Api,我想更改或删除更改blankstate消息中的所有行,该消息在下面的代码中得到响应 Protected function render_blank_state() { echo '<div class="woocommerce-BlankState">'; echo '<h2 class="woocommerce-BlankState-message">' . esc_h

我想更改或删除更改blankstate消息中的所有行,该消息在下面的代码中得到响应

         Protected function render_blank_state() {
        echo '<div class="woocommerce-BlankState">';
     
        echo '<h2 class="woocommerce-BlankState-message">' . esc_html__( 'When you receive a new order, it will appear here.', 'woocommerce' ) . '</h2>';
     //want to delete or change this below
        echo '<div class="woocommerce-BlankState-buttons">';
        echo '<a class="woocommerce-BlankState-cta button-primary button" target="_blank" href="https://docs.woocommerce.com/document/managing-orders/?utm_source=blankslate&utm_medium=product&utm_content=ordersdoc&utm_campaign=woocommerceplugin">' . esc_html__( 'Learn more about orders', 'woocommerce' ) . '</a>';
        echo '</div>';
     
        do_action( 'wc_marketplace_suggestions_orders_empty_state' );
     
        echo '</div>';

 ***CSS display :none; doesn't work***
Protected function render\u blank\u state(){
回声';
回显“”。esc_html_uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu;
//要删除或更改以下内容吗
回声';
回声';
回声';
执行操作(“wc_市场_建议_订单_清空_状态”);
回声';
***CSS显示:无;不工作***

由于其回声,因此无法在该代码中更改它。当我返回一点时,我看到该函数是从一个函数调用的,该函数通过钩子从另一个函数调用:

add_action( 'manage_posts_extra_tablenav', array( $this, 'maybe_render_blank_state' ) );
您现在可以做的是首先从这个钩子中删除这个函数:

现在,您可以继续添加自己的函数,该函数完成以下函数中包含的所有操作:

add_action( 'manage_posts_extra_tablenav', 'custom_maybe_render_blank_state' );
function custom_maybe_render_blank_state( $which ) {
    global $post_type;

    // You need to log the post type and maybe add a check here
    if ( $post_type === 'check_list_table_type_here' && 'bottom' === $which ) {
        $counts = (array) wp_count_posts( $post_type );
        unset( $counts['auto-draft'] );
        $count = array_sum( $counts );

        if ( 0 < $count ) {
            return;
        }

//      $this->render_blank_state(); <- skip

        // Do your own code here including the one from render_blank_state() function

        echo '<style type="text/css">#posts-filter .wp-list-table, #posts-filter .tablenav.top, .tablenav.bottom .actions, .wrap .subsubsub  { display: none; } #posts-filter .tablenav.bottom { height: auto; } </style>';
    }
}
add_操作('manage_posts_extra_tablenav'、'custom_maybe_render_blank_state');
函数自定义\可能\呈现\空白\状态($which){
全球$post_类型;
//您需要记录帖子类型,并在此处添加检查
if($post\u type=='check\u list\u table\u type\u here'&&&'bottom'==$which){
$counts=(数组)wp\u count\u posts($post\u type);
未设置($counts['auto-draft']);
$count=数组的总和($counts);
如果(0<$count){
返回;
}
//$this->render_blank_state();
add_action( 'manage_posts_extra_tablenav', 'custom_maybe_render_blank_state' );
function custom_maybe_render_blank_state( $which ) {
    global $post_type;

    // You need to log the post type and maybe add a check here
    if ( $post_type === 'check_list_table_type_here' && 'bottom' === $which ) {
        $counts = (array) wp_count_posts( $post_type );
        unset( $counts['auto-draft'] );
        $count = array_sum( $counts );

        if ( 0 < $count ) {
            return;
        }

//      $this->render_blank_state(); <- skip

        // Do your own code here including the one from render_blank_state() function

        echo '<style type="text/css">#posts-filter .wp-list-table, #posts-filter .tablenav.top, .tablenav.bottom .actions, .wrap .subsubsub  { display: none; } #posts-filter .tablenav.bottom { height: auto; } </style>';
    }
}