mirror of
https://github.com/10h30/display-featured-image-genesis.git
synced 2026-07-11 18:46:03 +09:00
Use admin_post_thumbnail ID arg
This commit is contained in:
@@ -25,7 +25,7 @@ class Display_Featured_Image_Genesis_Post_Meta {
|
||||
/**
|
||||
* Build the metabox with the checkbox setting.
|
||||
*/
|
||||
public function meta_box( $content ) {
|
||||
public function meta_box( $content, $post_id ) {
|
||||
|
||||
$output = wp_nonce_field( 'displayfeaturedimagegenesis_post_save', 'displayfeaturedimagegenesis_post_nonce', true, false );
|
||||
$checkboxes = array(
|
||||
@@ -39,7 +39,7 @@ class Display_Featured_Image_Genesis_Post_Meta {
|
||||
),
|
||||
);
|
||||
foreach ( $checkboxes as $checkbox ) {
|
||||
$output .= $this->do_checkbox( $checkbox );
|
||||
$output .= $this->do_checkbox( $checkbox, $post_id );
|
||||
}
|
||||
|
||||
return $output . $content;
|
||||
@@ -51,8 +51,8 @@ class Display_Featured_Image_Genesis_Post_Meta {
|
||||
*
|
||||
* @return string checkbox label/input
|
||||
*/
|
||||
protected function do_checkbox( $args ) {
|
||||
$check = get_post_meta( get_the_ID(), $args['setting'], true ) ? 1 : '';
|
||||
protected function do_checkbox( $args, $post_id ) {
|
||||
$check = get_post_meta( $post_id, $args['setting'], true ) ? 1 : '';
|
||||
$output = '<p>';
|
||||
$output .= sprintf( '<label for="%s">', $args['setting'] );
|
||||
$output .= sprintf( '<input type="checkbox" id="%1$s" name="%1$s" %2$s />%3$s', $args['setting'], checked( $check, 1, false ), $args['label'] );
|
||||
|
||||
@@ -119,7 +119,7 @@ class Display_Featured_Image_Genesis {
|
||||
add_filter( 'plugin_action_links_' . DISPLAYFEATUREDIMAGEGENESIS_BASENAME, array( $this, 'add_settings_link' ) );
|
||||
add_filter( 'displayfeaturedimagegenesis_get_setting', array( $this->settings, 'get_display_setting' ) );
|
||||
add_filter( 'genesis_get_image_default_args', array( $this->output, 'change_thumbnail_fallback' ) );
|
||||
add_filter( 'admin_post_thumbnail_html', array( $this->post_meta, 'meta_box' ) );
|
||||
add_filter( 'admin_post_thumbnail_html', array( $this->post_meta, 'meta_box' ), 10, 2 );
|
||||
add_action( 'save_post', array( $this->post_meta, 'save_meta' ) );
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user