2013-02-10 63 views
2

enter image description here我想找出什麼動作鉤/過濾器我可以用來插入管理「edit.php」頁面上的內容(我想放置上面的幾個鏈接'帖子'表)?我找到了「edit_form_after_title」和「edit_form_after_editor」(這些完全是我想要做的,但它們是針對posts.php,而不是edit.php)。WordPress的:添加內容到edit.php

回答

3

如果你只是想補充的帖子標題鏈接,你可以做這樣的事情

if (is_admin()) { 
    add_filter('the_title', function($title) { 
     return $before_title . $title . $after_title; 
    }); 
} 

但是,就像你要添加文本的標題鏈接不健全。

要在標題後添加HTML和之前的行爲的鏈接,你可以做這樣的

if (is_admin()) { 
    add_filter('post_row_actions', function($args) { 
     // echo your custom content here 
     return $args; // and dont forget to return the actions 
    }); 
} 

還有page_row_actions的頁面編輯屏幕(post_row_actions僅供職位)

據作爲標題之前添加的東西,我沒有看到一個鉤子/過濾器來做到這一點。如果你想尋找自己,請參閱wp-admin/class-wp-posts-list-table.php行463 function single_row

+0

謝謝!我添加了一個截圖來向你展示我在找什麼。我會檢查這些網頁! – execv 2013-02-10 05:46:12

3

這個答案的幫助:https://wordpress.stackexchange.com/a/115164/59816

我想出了這一點:

<?php 
 
# Called only in /wp-admin/edit.php pages 
 
add_action('load-edit.php', function() { 
 
    add_filter('views_edit-talk', 'talk_tabs'); // talk is my custom post type 
 
}); 
 

 
# echo the tabs 
 
function talk_tabs() { 
 
echo ' 
 
    <h2 class="nav-tab-wrapper"> 
 
    <a class="nav-tab" href="admin.php?page=guests">Profiles</a> 
 
    <a class="nav-tab nav-tab-active" href="edit.php?post_type=talk">Talks</a> 
 
    <a class="nav-tab" href="edit.php?post_type=offer">Offers</a> 
 
    </h2> 
 
'; 
 
} 
 
?>

它看起來是這樣的:

enter image description here

希望這可以幫助某人。

+0

完美答案謝謝!任何想法如何使用edit-tags.php爲分類頁面做到這一點? – RafaSashi 2017-05-02 13:43:08

+0

也許這會幫助嗎? https://wordpress.stackexchange.com/questions/242633/editing-edit-tags-php-page-in-wp-admin – 2017-05-09 14:58:35