diff --git a/functions.php b/functions.php
index 0091e938..2c87e89f 100644
--- a/functions.php
+++ b/functions.php
@@ -396,60 +396,3 @@ function fau_embedded_posts( $query ) {
require_once( get_template_directory() . '/functions/gutenberg.php');
-
-
-
-
-// Move the following block to functions/custom-fields.php please...
-
-/*-----------------------------------------------------------------------------------*/
-/*Hide and show feutured image
-/*-----------------------------------------------------------------------------------*/
-function hide_featured_image_meta_box() {
- add_meta_box( 'hide_featured_image', 'Featured Image', 'hide_featured_image_callback', 'post', 'side', 'low' );
-}
-add_action( 'add_meta_boxes', 'hide_featured_image_meta_box' );
-function hide_featured_image_callback( $post ) {
- $value = get_post_meta( $post->ID, '_hide_featured_image', true );
- echo '';
-}
-
-
-function hide_featured_image_save_post( $post_id ) {
- if ( isset( $_POST['hide_featured_image'] ) ) {
- update_post_meta( $post_id, '_hide_featured_image', 1 );
- } else {
- delete_post_meta( $post_id, '_hide_featured_image' );
- }
-
- // Add the following code to set a cookie with the checkbox value
-// setcookie( 'hide_featured_image', isset( $_POST['hide_featured_image'] ), time() + 86400, COOKIEPATH, COOKIE_DOMAIN );
-
- // Rework this please. See: https://github.com/RRZE-Webteam/FAU-Einrichtungen/issues/1288
-}
-add_action( 'save_post', 'hide_featured_image_save_post' );
-
-
-/*-----------------------------------------------------------------------------------*/
-/* Outside-box image post block
- *
- * Note: Please move Block Editor stuff to functions/gutenberg.php
- */
-/*-----------------------------------------------------------------------------------*/
-function fau_custom_image_blocks() {
- wp_register_script(
- 'my-custom-blocks',
- get_template_directory_uri() . '/js/fau-costum-image-block.min.js',
- array( 'wp-blocks', 'wp-editor' ),
- true
- );
- register_block_type( 'my-blocks/full-width-image', array(
- 'editor_script' => 'my-custom-blocks',
- ) );
-}
-add_action( 'init', 'fau_custom_image_blocks' );
-
-
-/*-----------------------------------------------------------------------------------*/
-/* This is the end of the code as we know it
-/*-----------------------------------------------------------------------------------*/
diff --git a/functions/custom-fields.php b/functions/custom-fields.php
index 45e30a28..3f90954f 100644
--- a/functions/custom-fields.php
+++ b/functions/custom-fields.php
@@ -15,7 +15,6 @@ function fau_metabox_cf_setup() {
add_action('add_meta_boxes_page', 'fau_add_metabox_page');
add_action('add_meta_boxes_post', 'fau_add_metabox_post');
-
/* Save sidecontent */
add_action('save_post', 'fau_save_metabox_page_untertitel', 10, 2);
@@ -133,7 +132,19 @@ function fau_add_metabox_post() {
'fau_do_metabox_post_vidpod',
'post', 'side', 'low'
);
+
+ // Hide Featured Image meta box
+ add_meta_box(
+ 'fau_metabox_post_teaser',
+ esc_html__('Beitragsoptionen', 'fau'),
+ 'fau_do_metabox_post_teaser',
+ 'post', 'normal', 'high'
+ );
}
+
+
+
+
/*-----------------------------------------------------------------------------------*/
/* Display Options for posts
/*-----------------------------------------------------------------------------------*/
@@ -180,6 +191,9 @@ function fau_do_metabox_post_teaser($object, $box) {
$sliderimage = get_post_meta($object->ID, 'fauval_slider_image', true);
fau_form_image('fauval_slider_image', $sliderimage, __('Bühnenbild', 'fau'), __('An dieser Stelle kann optional ein alternatives Bild für die Bühne der Startseite ausgewählt werden, falls das normale Beitragsbild hierzu nicht verwendet werden soll.', 'fau'), 540, 150);
}
+ $value = get_post_meta($object->ID, '_hide_featured_image', true);
+
+ echo '';
}
/*-----------------------------------------------------------------------------------*/
/* Save the meta box's post metadata.
@@ -239,7 +253,14 @@ function fau_save_post_teaser($post_id, $post) {
} else {
delete_post_meta($post_id, 'fauval_slider_image');
}
+ if (isset($_POST['hide_featured_image'])) {
+ update_post_meta($post_id, '_hide_featured_image', 1);
+ } else {
+ delete_post_meta($post_id, '_hide_featured_image');
+ }
}
+
+
/* Display Options for pages */
function fau_do_metabox_post_topevent($object, $box) {
diff --git a/functions/gutenberg.php b/functions/gutenberg.php
index 2540708d..d827f505 100644
--- a/functions/gutenberg.php
+++ b/functions/gutenberg.php
@@ -147,6 +147,31 @@ function fau_is_newsletter_plugin_active() {
return false;
}
+
+
+/*-----------------------------------------------------------------------------------*/
+/* Outside-box image post block
+/*-----------------------------------------------------------------------------------*/
+function fau_custom_image_blocks() {
+ wp_register_script(
+ 'my-custom-blocks',
+ get_template_directory_uri() . '/js/fau-costum-image-block.min.js',
+ array( 'wp-blocks', 'wp-editor' ),
+ true
+ );
+ register_block_type( 'my-blocks/full-width-image', array(
+ 'editor_script' => 'my-custom-blocks',
+ ) );
+}
+add_action( 'init', 'fau_custom_image_blocks' );
+
+
+/*-----------------------------------------------------------------------------------*/
+/* This is the end of the code as we know it
+/*-----------------------------------------------------------------------------------*/
+
+
+
/*-----------------------------------------------------------------------------------*/
/* Defined allowed core block types if theme is used in Gutenberg Block Editor
/*-----------------------------------------------------------------------------------*/