Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author WebshopLogic

    (@webshoplogic)

    If you would like to use php code to generate tab content, you can use actions or filters in WordPress. It is not possible to add php code in the editor window for security reasons.

    In the PRO version of the plugin you can add this code to your functions.php file in the directory of your active theme:

    add_filter ('wct_woocommerce_tab_content', 'change_wct_woocommerce_tab_content', 10, 2);
    function change_wct_woocommerce_tab_content($tab_content, $tab_code) {
    
    	$tab_content = 'Hi! ' . $tab_content; //the required content should be generated in this line 
    
    	return $tab_content;
    }

    The required content should be placed into $tab_content variable.

    You can find more information about filters here:
    https://codex.www.ads-software.com/Function_Reference/add_filter

    Another option in WP of creating a shortcode that generates the required content. This short code can be inserted in the content editor fields. You can find information about shortcodes here:
    https://codex.www.ads-software.com/Function_Reference/add_shortcode

    I hope this information is useful for you.

    Peter

    Thread Starter Aishwarya Taneja

    (@aishwaryataneja85)

    I think my question was not clear so let me do that first.

    I didn’t want to add any php code in editor.

    I just want to know that which code can be used at back-end to get that information on desired pages.

    example : If I use the following code
    <?php the_content(); ?>
    in the any template from back-end I can get the details of that sections filled in the editor.

    So similarly I want to know that what is code which displays the content of addition editor added when created new tab using this plugin.

    I want to display that information put in the editor at 2-3 places other than tabs so.

    Hope now I made myself clear.

    Regards;
    Aishwarya.

    Plugin Author WebshopLogic

    (@webshoplogic)

    Hi Aishwarya!

    Try this code:

    global $wct;
    $wct->woocommerce_tab_content('your_tab_code');

    Use the code (slug) of that tab type of which content you would like to display beside ‘your_tab_code’.
    You can find more information of how can you find of tab type’s code (slug of tab types) here: https://webshoplogic.com/product/woocommerce-custom-tabs-pro-plugin?#tab-faq

    I hope this will help you.

    Peter

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘What is code for the content?’ is closed to new replies.