Comments 1onpageukr started the conversationJuly 25, 2022 at 4:46pmGood afternoon. Tell me please. You need to display a description of the category in the portfolio. Under the output of the elements, at the bottom. How can I do that?Thanks for the awesome theme!! 1onpageukr repliedJuly 25, 2022 at 4:52pmThere is a code that displays a description under the products in the category. How can it be modified and used?add_action( 'product_cat_edit_form_fields', 'wpm_taxonomy_edit_meta_field', 10, 2 ); function wpm_taxonomy_edit_meta_field($term) { $t_id = $term->term_id; $term_meta = get_option( "taxonomy_$t_id" ); $content = $term_meta['custom_term_meta'] ? wp_kses_post( $term_meta['custom_term_meta'] ) : ''; $settings = array( 'textarea_name' => 'term_meta[custom_term_meta]' ); ?> <tr class="form-field"> <th scope="row" valign="top"><label for="term_meta[custom_term_meta]">Second description or banners at the bottom for the category</label></th> <td> <?php wp_editor( $content, 'product_cat_details', $settings ); ?> </td> </tr> <?php} add_action( 'edited_product_cat', 'save_taxonomy_custom_meta', 10, 2 );add_action( 'create_product_cat', 'save_taxonomy_custom_meta', 10, 2 ); function save_taxonomy_custom_meta( $term_id ) { if ( isset( $_POST['term_meta'] ) ) { $t_id = $term_id; $term_meta = get_option( "taxonomy_$t_id" ); $cat_keys = array_keys( $_POST['term_meta'] ); foreach ( $cat_keys as $key ) { if ( isset ( $_POST['term_meta'][$key] ) ) { $term_meta[$key] = wp_kses_post( stripslashes($_POST['term_meta'][$key]) ); } } update_option( "taxonomy_$t_id", $term_meta ); }} add_action( 'woocommerce_after_shop_loop', 'wpm_product_cat_archive_add_meta' ); function wpm_product_cat_archive_add_meta() { $t_id = get_queried_object()->term_id; $term_meta = get_option( "taxonomy_$t_id" ); $term_meta_content = $term_meta['custom_term_meta']; if ( $term_meta_content != '') { if ( is_tax( array( 'product_cat', 'product_tag' ) ) && 0 === absint( get_query_var( 'paged' ) ) ) { echo '<div class="woo-sc-box normal rounded full">'; echo apply_filters( 'the_content', $term_meta_content ); echo '</div>'; } }} 8,939Tahir repliedJuly 26, 2022 at 5:27amHey Again,If you wish to alter the Project Archive pages you will have to edit the "index.php" via a Child Theme. Thanks ThemeNectar Support Team 1onpageukr repliedJuly 26, 2022 at 4:56pmIs there a code example to change? 1,919Judith repliedJuly 26, 2022 at 6:15pmHello There,Code customization of the core files is beyond our scope of support. I would recommend hiring a private developer to assist with further customization.Thanks. Sign in to reply ...
Good afternoon. Tell me please.
You need to display a description of the category in the portfolio. Under the output of the elements, at the bottom.
How can I do that?
Thanks for the awesome theme!!
There is a code that displays a description under the products in the category. How can it be modified and used?
add_action( 'product_cat_edit_form_fields', 'wpm_taxonomy_edit_meta_field', 10, 2 );
function wpm_taxonomy_edit_meta_field($term) {
$t_id = $term->term_id;
$term_meta = get_option( "taxonomy_$t_id" );
$content = $term_meta['custom_term_meta'] ? wp_kses_post( $term_meta['custom_term_meta'] ) : '';
$settings = array( 'textarea_name' => 'term_meta[custom_term_meta]' );
?>
<tr class="form-field">
<th scope="row" valign="top"><label for="term_meta[custom_term_meta]">Second description or banners at the bottom for the category</label></th>
<td>
<?php wp_editor( $content, 'product_cat_details', $settings ); ?>
</td>
</tr>
<?php
}
add_action( 'edited_product_cat', 'save_taxonomy_custom_meta', 10, 2 );
add_action( 'create_product_cat', 'save_taxonomy_custom_meta', 10, 2 );
function save_taxonomy_custom_meta( $term_id ) {
if ( isset( $_POST['term_meta'] ) ) {
$t_id = $term_id;
$term_meta = get_option( "taxonomy_$t_id" );
$cat_keys = array_keys( $_POST['term_meta'] );
foreach ( $cat_keys as $key ) {
if ( isset ( $_POST['term_meta'][$key] ) ) {
$term_meta[$key] = wp_kses_post( stripslashes($_POST['term_meta'][$key]) );
}
}
update_option( "taxonomy_$t_id", $term_meta );
}
}
add_action( 'woocommerce_after_shop_loop', 'wpm_product_cat_archive_add_meta' );
function wpm_product_cat_archive_add_meta() {
$t_id = get_queried_object()->term_id;
$term_meta = get_option( "taxonomy_$t_id" );
$term_meta_content = $term_meta['custom_term_meta'];
if ( $term_meta_content != '') {
if ( is_tax( array( 'product_cat', 'product_tag' ) ) && 0 === absint( get_query_var( 'paged' ) ) ) {
echo '<div class="woo-sc-box normal rounded full">';
echo apply_filters( 'the_content', $term_meta_content );
echo '</div>';
}
}
}
Hey Again,
If you wish to alter the Project Archive pages you will have to edit the "index.php" via a Child Theme.
Thanks
ThemeNectar Support Team
Is there a code example to change?
Hello There,
Code customization of the core files is beyond our scope of support. I would recommend hiring a private developer to assist with further customization.
Thanks.