-
AuthorPosts
-
April 25, 2015 at 6:23 pm #434729
Is there a way to make “Don’t display image on single post” checked by default? I use a plugin that automatically creates posts and do not want the featured image on them.
April 27, 2015 at 10:53 am #435137Hey DJQuad!
Thank you for coming back.
If you are using a child theme in functions.php of the child theme put the following:
/* Add a checkbox to the featured image metabox */ if(!function_exists('avia_theme_featured_image_meta')) { add_filter( 'admin_post_thumbnail_html', 'avia_theme_featured_image_meta'); function avia_theme_featured_image_meta( $content ) { global $post, $post_type; if($post_type == "post") { $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'" : ""; $selected = "checked='checked'"; $label = '</div><div class="av-meta-extra-inside"><label for="' . $id . '" class="selectit"><input '.$selected.' name="' . $id . '" type="checkbox" id="' . $id . '" value="1" > ' . $text .'</label>'; return $content .= $label; } return $content; } }
Otherwise modify enfold\functions-enfold.php line 1188: locate
$selected = !empty($value) ? "checked='checked'" : "";
and replace with:
// $selected = !empty($value) ? "checked='checked'" : ""; $selected = "checked='checked'";
Regards,
GünterApril 27, 2015 at 4:49 pm #435405Thanks. Will this also make it not display the featured image on posts created outside of that form?
April 28, 2015 at 9:42 am #435870Hi!
What do you mean by “posts created outside of that form”? The code above should enable the Don’t display image on single post option by default.
Regards,
IsmaelApril 28, 2015 at 3:35 pm #436099Like I said in my OP, a plugin creates some of the posts. I also post via Email.
April 29, 2015 at 4:47 pm #436825Hey!
Please give us a link an example of the post. Maybe, we can use css to hide it.
Cheers!
IsmaelApril 29, 2015 at 5:44 pm #436885This reply has been marked as private.May 1, 2015 at 12:15 pm #437986Hi!
Please add following code to Quick CSS in Enfold theme options under General Styling tab
.single .big-preview.single-big { display: none !important; }
Cheers!
YigitMay 1, 2015 at 4:22 pm #438170That won’t work because some posts do have featured images. I’d just like them to be not showed by default, unless I edit the post and uncheck the option.
May 4, 2015 at 3:21 pm #438945Hi!
I’m not sure how this plugin creates the post. You can’t access those posts in the Posts panel?
Cheers!
IsmaelMay 4, 2015 at 4:49 pm #439064Yes. Regardless whether I use the plugin or not (I may end up not), it would still be an issue with posting via Email. I’d like the image to automatically not be displayed by default. If I want it to be displayed I can edit the post later.
May 6, 2015 at 6:20 am #440127Hey!
Alright. What do you mean by “posting via Email”? You’re trying to make a simple thing complicated or trying to fully automate the settings. If you don’t want a featured image on a post then don’t add a featured image. If you do want a featured image but don’t want to display it in a single post then tick the option under the featured image box. Aside from that, I don’t think we can help with the plugin nor the email settings. Please contact a developer to configure those settings.
Regards,
IsmaelSeptember 19, 2016 at 3:41 am #688240// $selected = !empty($value) ? “checked=’checked'” : “”;
$selected = “checked=’checked'”;It’s works. thanks
這個程式碼可以使用,謝謝- This reply was modified 8 years, 2 months ago by Moaaaaya.
September 20, 2016 at 6:27 am #688939 -
AuthorPosts
- The topic ‘Don't display image on single post’ is closed to new replies.