Tagged: featured image
Viewing 3 posts - 1 through 3 (of 3 total)
-
AuthorPosts
-
April 29, 2014 at 10:12 am #257546
Hi,
I’ve checked the new featured for remove the featured image on single post. But this only works on posts. If I want to remove this featured image on CPT I checked that the code is on functions-enfold.php
So I copy my code and change the name of the functions to avoid problems with the original functions. So this is the code that I have in my functions child-theme file:
/* Add a checkbox to the featured image metabox */ if(!function_exists('theme_featured_image_meta')) { add_filter( 'admin_post_thumbnail_html', 'theme_featured_image_meta'); function theme_featured_image_meta( $content ) { global $post_type; if($post_type == "meeting") { $text = __( "Don't display image on single post", 'avia_framework' ); $id = '_avia_hide_featured_image'; $value = esc_attr( get_post_meta( $post->ID, $id, true ) ); $selected = !empty($value) ? "checked='checked'" : ""; $label = '<label for="' . $id . '" class="selectit"><input '.$selected.' name="' . $id . '" type="checkbox" id="' . $id . '" value="1" > ' . $text .'</label>'; return $content .= $label; } return $content; } } /* Make sure the checkbox above is saved properly */ if(!function_exists('add_feature_image_checkbox')) { add_filter( 'avf_builder_elements', 'add_feature_image_checkbox'); function add_feature_image_checkbox($elements) { $elements[] = array( "slug" => "layout", "id" => "_avia_hide_featured_image", "type" => "fake", ); return $elements; } }The thing is the function to save the checkbox doesn’t work. What should I do? Thanks
April 30, 2014 at 8:08 pm #258459Hi Pedro!
You probably need to keep the global post object in the function.
Cheers!
DevinMay 5, 2014 at 11:02 am #260175Thank you. Now works :)
-
AuthorPosts
Viewing 3 posts - 1 through 3 (of 3 total)
- The topic ‘Remove featured image’ is closed to new replies.
