D
D
dimasibirak2016-11-20 22:39:52
Web development
dimasibirak, 2016-11-20 22:39:52

How to add video to category description and display woocomerce?

Hello gentlemen, for 2 days I have been suffering with the conclusion in the description of the product category of the video.
I decided to go this way, there is a code:

<?php
 global $post;
$args = array( 'taxonomy' => 'product_cat',);
$terms = wp_get_post_terms($post->ID,'product_cat', $args);

    $count = count($terms);
    if ($count > 0) {

        foreach ($terms as $term) {
            echo '<div style="direction:rtl;">';
            echo $term->description;
            echo '</div>';
        }
    }
?>

I found it on the Internet, it does an excellent job of displaying a category description, but there is a small problem, it displays everything literally without processing (as a result, short codes refuse to work).
Without them, I can't embed a video because the output is a shortcode instead of a video.
Thank you in advance for your response.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Igor Vorotnev, 2016-11-23
@dimasibirak

Add to functions.php
add_filter( 'term_description', 'do_shortcode' );

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question