Home Forums WoodMart support forum Remove author metadata from post Reply To: Remove author metadata from post

#546115

immolib
Participant

SO 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 ”;
}