/*
Theme Name: My Child Theme. Child for Twenty Nineteen.
Theme URI: https://rachelmccollin.com
Description: Theme to support tutsplus tutorial. Child theme for the Twenty Nineteen theme.
Author: Rachel McCollin
Textdomain: mccollin
Author URI: https://rachelmccollin.com/
Template: twentynineteen
Version: 1.0
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
*/
/*
Theme Name: My Child Theme. Child for Twenty Nineteen.
Theme URI: https://rachelmccollin.com
Description: Theme to support tutsplus tutorial. Child theme for the Twenty Nineteen theme.
Author: Rachel McCollin
Textdomain: mccollin
Author URI: https://rachelmccollin.com/
Template: twentynineteen
Version: 1.0
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
*/
例如:apply_filters( 'admin_footer_text' , string $text )过滤器可以是钩状来修改在管理页脚显示的文本。从WordPress 5.4开始,其默认值将 在管理区域页脚中显示该句子。Thank you for creating with WordPress.
// define the callback function to change the text
function change_text_callback() {
// add the code to change text here
}
// hook in to the ‘publish_post’ action with the add_action() function
add_action( ‘publish_post’, ‘change_text_callback’ );
// define the callback function to change the text
function change_text_callback() {
// add the code to change text here
}
// hook in to the 'publish_post' action with the add_action() function
add_action( 'publish_post', 'change_text_callback' );
// define the callback function to modify the text
function change_text_another_callback( $content ) {
// add the code to change text here and then return it
return $filtered_content;
}
// hook in to ‘the_content’ filter with the add_filter() function
add_filter( ‘the_content’, ‘change_text_another_callback’);
// define the callback function to modify the text
function change_text_another_callback( $content ) {
// add the code to change text here and then return it
return $filtered_content;
}
// hook in to 'the_content' filter with the add_filter() function
add_filter( 'the_content', 'change_text_another_callback');
<?php
/*
Plugin Name: Salhooks
Version : 1.0
Description: Demonstrating WordPress Hooks (Actions and Filters) with multiple examples.
Author : Salman Ravoof
Author URI : https://www.salmanravoof.com/
License : GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: salhooks
*/
//=================================================
// Security: Abort if this file is called directly
//=================================================
if ( !defined(‘ABSPATH’) ) {
die;
}
<?php
/*
Plugin Name: Salhooks
Version : 1.0
Description: Demonstrating WordPress Hooks (Actions and Filters) with multiple examples.
Author : Salman Ravoof
Author URI : https://www.salmanravoof.com/
License : GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: salhooks
*/
//=================================================
// Security: Abort if this file is called directly
//=================================================
if ( !defined('ABSPATH') ) {
die;
}