• using wordpress 6.1.1 and basic template twentytwentythree

    I created a child theme very basic and added a template page named template_shortcode.php. in that page, if i use :
    
    echo do_shortcode('[sayit lang="fr-FR" speed="0.75"]test sayit[/sayit]');
    
    The page comes out with all the content, but the shortcode is not executed correctly and return only "test sayit" as result. The shortcode tags are not there so they are executed but returns nothing. I tryed using other shortcodes and they work.
    
    if I dont use my personal template page and instead use the blank template of twentytwentythree, the buttons shows up.
    
    Any ideas of why it wont allow me to use the do_shotcode in my template page?
    
    Just for clarity, here is the template example :
    
    
    <?php
    /*
    Template Name: Shortcode Template
    */
    ?>
    
    <div id="primary" class="content-area">
    
    ? ? <main id="main" class="site-main">
    ? ? ? ? <div class="shortcode-content">
    ? ? ? ? ? ? <div class="mon_contenu">
    ? ? ? ? ? ? <?php
    ? ? ? ? ? ? if (have_posts()) {
    ? ? ? ? ? ? ? ? while (have_posts()) {
    ? ? ? ? ? ? ? ? the_post();
    ? ? ? ? ? ? ? ? $page_content = do_shortcode(get_the_content());
    ? ? ? ? ? ? ? ? echo $page_content;
    ? ? ? ? ? ? ? ? }
    ? ? ? ? ? ? }
    
    ? ? ? ? ? ? echo do_shortcode('[sayit lang="fr-FR" speed="0.75"]test sayit[/sayit]');
    ? ? ? ? ? ? ?>
    ? ? ? ? ? ? </div>
    ? ? ? ? </div>
    ? ? </main><!-- #main -->
    </div><!-- #primary -->
    

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

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

    (@lepetitweb)

    I am sorry, it was a stupid question… my only trouble was that a template without the header does miss the css and js files links to make it works…

Viewing 1 replies (of 1 total)
  • The topic ‘shortcode not executed while in a template page’ is closed to new replies.