Add option to hide categories on posts

This commit is contained in:
Tetrakern 2024-08-11 21:50:20 +02:00
parent b13e4ddfa9
commit f73aa30537
3 changed files with 18 additions and 1 deletions

View File

@ -1627,7 +1627,7 @@ if ( ! function_exists( 'fictioneer_get_post_meta_items' ) ) {
} }
// Category node // Category node
if ( ! ( $args['no_cat'] ?? 0 ) ) { if ( ! ( $args['no_cat'] ?? 0 ) && ! get_option( 'fictioneer_hide_categories' ) ) {
$output['category'] = sprintf( $output['category'] = sprintf(
'<div class="post__categories"><i class="fa-solid fa-tags"></i> %s</div>', '<div class="post__categories"><i class="fa-solid fa-tags"></i> %s</div>',
get_the_category_list(', ') get_the_category_list(', ')

View File

@ -671,6 +671,12 @@ define( 'FICTIONEER_OPTIONS', array(
'group' => 'fictioneer-settings-general-group', 'group' => 'fictioneer-settings-general-group',
'sanitize_callback' => 'fictioneer_sanitize_checkbox', 'sanitize_callback' => 'fictioneer_sanitize_checkbox',
'default' => 0 'default' => 0
),
'fictioneer_hide_categories' => array(
'name' => 'fictioneer_hide_categories',
'group' => 'fictioneer-settings-general-group',
'sanitize_callback' => 'fictioneer_sanitize_checkbox',
'default' => 0
) )
), ),
'integers' => array( 'integers' => array(
@ -1134,6 +1140,7 @@ function fictioneer_get_option_label( $option ) {
'fictioneer_override_chapter_status_icons' => __( 'Override chapter status icons', 'fictioneer' ), 'fictioneer_override_chapter_status_icons' => __( 'Override chapter status icons', 'fictioneer' ),
'fictioneer_enable_custom_fields' => __( 'Enable custom fields', 'fictioneer' ), 'fictioneer_enable_custom_fields' => __( 'Enable custom fields', 'fictioneer' ),
'fictioneer_disable_anti_flicker' => __( 'Disable anti-flicker script', 'fictioneer' ), 'fictioneer_disable_anti_flicker' => __( 'Disable anti-flicker script', 'fictioneer' ),
'fictioneer_hide_categories' => __( 'Hide categories on posts', 'fictioneer' ),
); );
} }

View File

@ -76,6 +76,16 @@
?> ?>
</div> </div>
<div class="fictioneer-card__row">
<?php
fictioneer_settings_label_checkbox(
'fictioneer_hide_categories',
__( 'Hide categories on posts', 'fictioneer' ),
__( 'If you do not need them anyway.', 'fictioneer' )
);
?>
</div>
<div class="fictioneer-card__row"> <div class="fictioneer-card__row">
<?php <?php
fictioneer_settings_label_checkbox( fictioneer_settings_label_checkbox(