Home › Forums › WoodMart support forum › Remove author metadata from post
Remove author metadata from post
- This topic has 16 replies, 4 voices, and was last updated 8 months, 3 weeks ago by Luke Nielsen.
-
AuthorPosts
-
December 20, 2023 at 12:01 pm #523236
joel.karununganParticipantAs the title suggests, how do I remove the following author meta data in blogs/posts, without the use of CSS display: none? Ideally the entire meta-author HTML as seen in the screenshot (meta-author, author-avatar, etc) Thanks in advance!
- This topic was modified 11 months, 1 week ago by joel.karunungan.
Attachments:
You must be logged in to view attached files.December 20, 2023 at 3:28 pm #523343
Artem TemosKeymasterHello,
You can disable this option in Theme Settings -> Blog -> Blog archive -> Meta information (Off)
https://prnt.sc/vJBFBIMHl2jxKind Regards
December 21, 2023 at 4:47 am #523527
joel.karununganParticipantI already have this setting disabled. The meta data is not showing in the blogs page which is working. However I do not want the meta data to show in the individual blogpost as well (Refer to screenshot)
It seems like there’s no existing feature in Theme Settings to achieve this. Is there a PHP function, filter, or hook to remove the entire meta-author HTML?
Attachments:
You must be logged in to view attached files.December 21, 2023 at 1:05 pm #523650
Artem TemosKeymasterTry to add the following PHP code snippet to the child theme functions.php file to do this
add_action( 'loop_start', function() { if ( isset( $GLOBALS['woodmart_loop']['parts_meta'] ) ) { $GLOBALS['woodmart_loop']['parts_meta'] = false; } }, 20 );
December 22, 2023 at 6:00 am #523888
joel.karununganParticipantThank you, this is working. However it is removing the post category/category tag along with the author meta. Is there a code snippet that only removes author meta?
Attachments:
You must be logged in to view attached files.December 22, 2023 at 11:05 am #523949
Artem TemosKeymasterThere is no filter for that case, unfortunately. But you can do this in the file
content.php
. Copy it to the child theme, find thewoodmart_post_meta
call https://prnt.sc/LhHsDhx_9s2v and replace parameter1
to0
as shown on the screenshot https://prnt.sc/XKUjS-hjMLwb
Let me know if it works.Kind Regards
February 28, 2024 at 3:35 pm #544705
immolibParticipantI dont understand why you dont put the metadata to display in single post as a theme option
This is a basic feature for most of the theme on the market !February 28, 2024 at 3:41 pm #544712
immolibParticipantps: editing content.php in child theme does not work anymore for that loop since last update
Author and icon are still displayed on single post headerAttachments:
You must be logged in to view attached files.February 29, 2024 at 3:47 pm #545079
Luke NielsenKeymasterHello,
Could you please send access to the admin panel so I can check the child theme?
Looking forward to collaborating with you!
Kind Regards
February 29, 2024 at 4:55 pm #545106
immolibParticipantHere it is
Thanks
March 1, 2024 at 11:48 am #545336
Luke NielsenKeymasterHello,
Seems that the access is wrong: https://take.ms/aK3Xq , could you please update it?
Thank you for your time and patience.
Kind Regards
March 1, 2024 at 12:04 pm #545341
immolibParticipantMarch 4, 2024 at 5:09 pm #546096
Luke NielsenKeymasterHello,
Thank you. In this case, you need to copy the
woodmart_page_title
function in theinc/template-tags/template-tags.php
file to the functions.php file in your child theme and in the copied function remove this https://monosnap.com/file/T0WxYqMY1FhYxZH7CesezaEPXQqRSe code.Also, delete everything you tried to do before.
Kind Regards
- This reply was modified 8 months, 3 weeks ago by Luke Nielsen.
March 4, 2024 at 6:03 pm #546115
immolibParticipantSO you want me to copy a full function from template-tags to our child theme function php !
1/Why not but i guess it any future update of your theme might break this
2/ I have just tried and it gives a fatal error :here is what i copy :
if ( ! function_exists( ‘woodmart_page_title’ ) ) {
/**
* Page title.
*/
function woodmart_page_title() {
global $wp_query;if ( function_exists( ‘dokan_is_store_page’ ) && dokan_is_store_page() ) {
return ”;
}$disable = false;
$page_title = true;
$breadcrumbs = woodmart_get_opt( ‘breadcrumbs’ );
$style = ”;
$page_for_posts = get_option( ‘page_for_posts’ );
$page_for_projects = woodmart_get_portfolio_page_id();
$title_class = ‘ page-title-‘;
$title_type = ‘default’;
$title_design = woodmart_get_opt( ‘page-title-design’ );
$title_size = woodmart_get_opt( ‘page-title-size’ );
$title_color = woodmart_get_opt( ‘page-title-color’ );
$shop_title = woodmart_get_opt( ‘shop_title’ );
$shop_categories = woodmart_get_opt( ‘shop_categories’ );
$single_post_design = woodmart_get_opt( ‘single_post_design’ );
$title_tag = ‘h1’;
$custom_page_title_tag = woodmart_get_opt( ‘page_title_tag’ );
$page_id = woodmart_page_ID();if ( ‘default’ !== $custom_page_title_tag && $custom_page_title_tag ) {
$title_tag = $custom_page_title_tag;
}/*
* Builder.
*/
$is_product_builder = Builder::get_instance()->has_custom_layout( ‘single_product’ );
$is_shop_product_builder = Builder::get_instance()->has_custom_layout( ‘shop_archive’ );
$is_cart_builder = Builder::get_instance()->has_custom_layout( ‘cart’ );
$is_checkout_form_builder = Builder::get_instance()->has_custom_layout( ‘checkout_form’ );
$is_checkout_content_builder = Builder::get_instance()->has_custom_layout( ‘checkout_content’ );
$is_builder_element = Builder_Data::get_instance()->get_data( ‘builder’ );
$builder_title_classes = Builder_Data::get_instance()->get_data( ‘title_classes’ );if ( ( $is_product_builder || $is_shop_product_builder || $is_cart_builder || $is_checkout_form_builder || $is_checkout_content_builder ) && ! $is_builder_element ) {
return ”;
}/*
* End Builder.
*/if ( 0 !== (int) $page_id ) {
$disable = get_post_meta( $page_id, ‘_woodmart_title_off’, true );$image = get_post_meta( $page_id, ‘_woodmart_title_image’, true );
$custom_title_color = get_post_meta( $page_id, ‘_woodmart_title_color’, true );
$custom_title_bg_color = get_post_meta( $page_id, ‘_woodmart_title_bg_color’, true );if ( is_array( $image ) && isset( $image[‘id’] ) ) {
$image = wp_get_attachment_image_url( $image[‘id’], ‘full’ );
}if ( $image ) {
$style .= ‘background-image: url(‘ . $image . ‘);’;
}if ( ” !== $custom_title_bg_color ) {
$style .= ‘background-color: ‘ . $custom_title_bg_color . ‘;’;
}if ( ” !== $custom_title_color && ‘default’ !== $custom_title_color ) {
$title_color = $custom_title_color;
}
}if ( ‘disable’ === $title_design ) {
$page_title = false;if ( $is_builder_element ) {
$title_design = ‘default’;
$page_title = true;
}
}if ( ! $page_title || ( ! $page_title && ! $breadcrumbs ) ) {
$disable = true;
}if ( is_singular( ‘post’ ) && ‘large_image’ === $single_post_design ) {
$disable = false;
}if ( $disable ) {
return ”;
}woodmart_enqueue_inline_style( ‘page-title’ );
if ( woodmart_woocommerce_installed() && ( is_product_taxonomy() || is_shop() || is_product_category() || is_product_tag() || woodmart_is_product_attribute_archive() ) ) {
woodmart_enqueue_inline_style( ‘woo-shop-page-title’ );if ( ! woodmart_get_opt( ‘shop_title’ ) ) {
woodmart_enqueue_inline_style( ‘woo-shop-opt-without-title’ );
}if ( woodmart_get_opt( ‘shop_categories’ ) ) {
woodmart_enqueue_inline_style( ‘shop-title-categories’ );
woodmart_enqueue_inline_style( ‘woo-categories-loop-nav-mobile-accordion’ );
}
}$title_class .= $title_type;
$title_class .= ‘ title-size-‘ . $title_size;
$title_class .= ‘ title-design-‘ . $title_design;if ( $builder_title_classes ) {
$title_class .= $builder_title_classes;
}if ( ‘large_image’ === $single_post_design && is_singular( ‘post’ ) ) {
$title_class .= ‘ color-scheme-light’;
} else {
$title_class .= ‘ color-scheme-‘ . $title_color;
}do_action( ‘woodmart_page_title’, $title_class, $style, $title_tag, $breadcrumbs, $page_title );
if ( ‘large_image’ === $single_post_design && is_singular( ‘post’ ) ) {
$image_url = get_the_post_thumbnail_url( $page_id );
if ( $image_url && ! $style ) {
$style .= ‘background-image: url(‘ . $image_url . ‘);’;
}
$title_class .= ‘ post-title-large-image’;?>
<div class=”page-title<?php echo esc_attr( $title_class ); ?>” style=”<?php echo esc_attr( $style ); ?>”>
<div class=”container”>
<?php if ( get_the_category_list( ‘, ‘ ) ) : ?>
<div class=”meta-post-categories wd-post-cat wd-style-with-bg”><?php echo get_the_category_list( ‘, ‘ ); // phpcs:ignore ?></div>
<?php endif ?><<?php echo esc_attr( $title_tag ); ?> class=”entry-title title”><?php the_title(); ?></<?php echo esc_attr( $title_tag ); ?>>
<?php do_action( ‘woodmart_page_title_after_title’ ); ?>
<div class=”entry-meta wd-entry-meta”>
<?php
woodmart_post_meta(
array(
‘author’ => 1,
‘author_avatar’ => 1,
‘date’ => 1,
‘comments’ => 1,
‘author_label’ => ‘long’,
)
);
?>
</div>
</div>
</div>
<?php
return ”;
}March 5, 2024 at 5:45 pm #546435
Luke NielsenKeymasterHello,
1. I sent your suggestion to the team, they will consider your suggestion. Thank you.
2. Sorry, I have added the above function and a few fields to fix that error and now it works well: https://take.ms/tahtl4
Let me know if you have any questions.
Kind Regards
March 5, 2024 at 6:13 pm #546441
immolibParticipantThank you !
March 5, 2024 at 6:18 pm #546443
Luke NielsenKeymasterHello,
You are welcome! In case you need any additional help, I’d be more than happy to assist you.
Have a good day!
Kind Regards
-
AuthorPosts
The topic ‘Remove author metadata from post’ is closed to new replies.
- You must be logged in to create new topics. Login / Register