• Resolved enricolino

    (@enricolino)


    Hello guys,

    I need some help to make this snippet work. I am trying to add a shortcode to display my html page wherever I like to, but there must be an error somewhere and I don’t seem to be able to solve the issue! I added this code to my functions.php file, in my child theme:

    add_shortcode("equipe", "equipe");  
    function equipe_html( $atts ) {  
    ob_start();
    include('./wp-content/themes/twentyseventeen_child/shortcode-equipe.php');
    $stringa = ob_get_contents();
    ob_end_clean();
    return $stringa;
    }

    Once added, I created a file called shortcode-equipe.php in which I wrote my html code and I uploaded both files into the child theme directory. Finally, I created a new page and I used [equipe] to display my equipe, but I can only see the shortcode [equipe] as an output. What did I do wrong? Can someone please help?

    Thanks a lot

    Cheers

    Enrico

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘shortcode to add templates’ is closed to new replies.