• Hello,
    I want to add an additional text field to product category pages with the plugin.
    I installed and set the plugin. A text field is now displayed in the backend. But when I enter a text, it is not displayed in the frontend.
    What have I done wrong?

    • This topic was modified 4 years, 11 months ago by alex818.
Viewing 1 replies (of 1 total)
  • You have to paste this code into the .php file which displays the information on your site:

    if (function_exists('wp_get_terms_meta'))
    { 
      $MetaValue = wp_get_terms_meta($category_id, $meta_key ,true); 
      //where $category_id is 'category/term id' and $meta_key is 'meta key'
    } 
    
    //meta value for meta key $meta_key
    echo $MetaValue;

    You can replace $category_id with $current_term->term_id to get the current ID of the page you are viewing.

    $meta_key gets replaced with the name of the meta field you created and is wrapped in single quotes

Viewing 1 replies (of 1 total)
  • The topic ‘Text is not displayed’ is closed to new replies.