开发者

Add new Button to a page in Wordpress

i wont to add a new Link on /wp-admin/edit.php by using a plugin.

I wont to have on every post a Li开发者_如何学编程nk to a page of my plugin and passing the postid

any idea to do this?

Add new Button to a page in Wordpress

thx


As I understand you exactly, you want meta box related features to be displayed in the edit form of the post right? Here is the solution for you.

function bilge_edit_custom_box() {
global $post;
echo '<input type="hidden" name="featured_noncename" id="featured_noncename" value="' . wp_create_nonce( plugin_basename(__FILE__) ) . '" />'; 

        $featured = get_post_meta($post->ID,'featured',true);
        if($featured=="1"){
            $checked1 = ' checked="checked" ';
        }else{
            $checked1 = '';
        }

        $summary = get_post_meta($post->ID,'summary',true);
        if($summary=="1"){
            $checked2 = ' checked="checked" ';
        }else{
            $checked2 = '';
        }

        $categored = get_post_meta($post->ID,'categored',true);
        if($categored=="1"){
            $checked3 = ' checked="checked" ';
        }else{
            $checked3 = '';
        }
echo '<p><input type="checkbox" id="featured" name="featured" value="1" '.$checked1.' />&nbsp;<label for="featured"><strong>'. _e('Featured Posts', 'bilge') .'</strong></label></p>';
echo '<p><input type="checkbox" id="summary" name="summary" value="1" '. $checked2.' />&nbsp;<label for="summary"><strong>'. _e('Summary Posts', 'bilge') .'</strong></label></p>';
echo '<p><input type="checkbox" id="categored" name="categored" value="1" '. $checked3.' />&nbsp;<label for="categored"><strong>'. _e('Category Based Posts', 'bilge') .'</strong></label></p>';

}

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜