如何在中使用面向对象概念add_filter
或add_action
是否具有优先级和参数数量?
这在没有其他参数的情况下是可能的:
add_filter(\'wp_get_attachment_image_src\', array($this, \'useCDN\');
有了参数,这是可能的吗?如何操作?如何在中使用面向对象概念add_filter
或add_action
是否具有优先级和参数数量?
这在没有其他参数的情况下是可能的:
add_filter(\'wp_get_attachment_image_src\', array($this, \'useCDN\');
有了参数,这是可能的吗?如何操作?这与程序中的方法相同,您需要提供priority
以及number of parameters
所以你会有;
add_filter(\'wp_get_attachment_image_src\', array($this, \'useCDN\'), 10, 3);
向过滤器传递3个附加参数我使用Wordpress主题,其中格式日期和时间直接编码为两种格式:<?php the_time(\'d M\'); ?> <?php the_time(\'H:i\'); ?> 我想要的:显示wordpress选项中定义的日期和时间我不想在子主题中创建修改过的模板,我更喜欢使用函数。我已经在函数中添加了php。php此代码有效:add_filter( \'the_time\', \'changer_date_format\', 10, 1 ); //o