• Resolved kambro

    (@kambro)


    Good evening,

    I created a WooCommerce custom taxonomy “book-author” for my bookstore.

    When I add html codes like italic text, the html codes are showed in frontend. See in the link the author’s description: <em>Commentaire</em>

    Thank you in advance.

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Thread Starter kambro

    (@kambro)

    I found the solution.

    I had insert this code to get the description:

    <?php
    function display_author_info() {
    $terms = wp_get_post_terms(get_the_ID(), 'author');
    if (isset($terms[0]->name) && isset($terms[0]->description)) {
            ?>
            <h3 class="titre-aut">Auteur</h3>
            <?php
        }
        if (isset($terms[0]->name)) {
            ?>
            <h4 class="author-title"><?php echo esc_html($terms[0]->name); ?></h4>
            <?php
        }
    if (isset($terms[0]->description)) {
    ?>
    <p class="author-texte"><?php echo esc_html($terms[0]->description); ?></p>
            <?php
        }
    }
    ?>
    
    <?php display_author_info(); ?>

    I used wp_kses_post() instead of esc_html() in: <p class="author-texte"><?php echo esc_html($terms[0]->description); ?></p>

    It’s OK.

Viewing 1 replies (of 1 total)
  • The topic ‘HTML code is showing on frontend in Custom taxonomy description’ is closed to new replies.