好吧,如果你打開你看到有一個在它不採取行動,我們可以掛鉤的核心文件。
只有幾個過濾器。我們可以使用以下命令:
add_filter('views_edit-movies', 'so_13813805_add_button_to_views');
function so_13813805_add_button_to_views($views)
{
$views['my-button'] = '<button id="update-from-provider" type="button" title="Update from Provider" style="margin:5px">Update from Provider</button>';
return $views;
}
它產生這樣的:
爲了把它的大致位置,從你想在哪裏,使用以下命令:
add_action('admin_head-edit.php', 'so_13813805_move_custom_button');
function so_13813805_move_custom_button()
{
global $current_screen;
// Not our post type, exit earlier
if('movies' != $current_screen->post_type)
return;
?>
<script type="text/javascript">
jQuery(document).ready(function($)
{
$('#update-from-provider').prependTo('span.displaying-num');
});
</script>
<?php
}
其中產品:
可以共享同一個屏幕截圖嗎? –
@ sunil221請看屏幕截圖。 謝謝。 –
@LeapBun按鈕點擊後我們如何調用代碼? – Celik