wordpress後台常用函式提示資訊彙總

2021-10-11 09:21:20 字數 1715 閱讀 7686

在wordpress開發中,尤其是使用中,常常會用到一些提示資訊,方便提醒使用者便利性的,所以在不同的位置需要有更多的提示來加強後台的使用體驗,這裡總結整理了一些比較常用的後台資訊提供函式

wordpress後台指定頁面頂部新增提示資訊 add_action

//提示資訊 function pagenotice() //add_action('admin_notices', 'pagenotice');/這是後台全域性提示 add_action( 'admin_head-post.php', 'pagenotice' );//文章編輯頁面 add_action( 'admin_head-post-new.php', 'pagenotice' );//文章/頁面 新建 add_action( 'admin_head-edit.php', 'pagenotice' );//文章列表

//提示資訊

function pagenotice()

* wordpress 給「特色影象」模組新增說明文字

* add_filter( 'admin_post_thumbnail_html', 'add_featured_image_instruction');

function add_featured_image_instruction( $content ) add_action( 'edit_form_after_title', 'below_the_title' ); function below_the_editor() add_action( 'edit_form_after_editor', 'below_the_editor' );

function below_the_title() add_action('login_footer', 'custom_html');

//自定義登入頁底部資訊

function custom_html()

echo '注意:這是一段警告,這是一段警告

';add_action('login_footer', 'custom_html');

wordpress 後台新增提示框

<?php } add_action( 'admin_print_footer_scripts', 'bing_add_pointer_scripts' ); //掛載提示框指令碼 function bing_admin_pointer_enqueue_scripts() add_action( 'admin_enqueue_scripts', 'bing_admin_pointer_enqueue_scripts' );

*wordpress 後台新增提示框

function bing_add_pointer_scripts(){

$content = '';

$content .= '請為新主題進行簡單的配置!';

<?php

add_action( 'admin_print_footer_scripts', 'bing_add_pointer_scripts' ); 

//掛載提示框指令碼

function bing_admin_pointer_enqueue_scripts(){

wp_enqueue_style( 'wp-pointer' );

wp_enqueue_script( 'wp-pointer' );

add_action( 'admin_enqueue_scripts', 'bing_admin_pointer_enqueue_scripts' );

wordpress 常用函式

wp loginout 主題中顯示 登出 鏈結。wpautop 這個函式用來轉換換行符字串為 標記,並把雙換行符作為乙個新的段落的開始,在前一段加入 並在新的段落加上 或 隨機文章 rand posts get posts numberposts 10 orderby rand foreach ra...

wordpress 常用函式

wp loginout 主題中顯示 登出 鏈結。wpautop 這個函式用來轉換換行符字串為 標記,並把雙換行符作為乙個新的段落的開始,在前一段加入 並在新的段落加上 或 隨機文章 rand posts get posts numberposts 10 orderby rand foreach ra...

WordPress常用函式大全

判斷頁面函式 is home 是否為主頁 is single 是否為內容頁 post is page 是否為內容頁 page is category 是否為category archive頁 is tag 是否為tag存檔頁 is date 是否為指定日期存檔頁 is year 是否為指定年份存檔頁...