Shortcodes do not work in my wordpress theme

Asked

Viewed 964 times

0

I’m creating my theme and it’s okay,

But I installed a plugin and it doesn’t work properly when added shortcodes to the theme. On the page it looks like in the console the html tags of the plugin, but there is a large white space without the slider, on the site before the page text appears. I changed theme to see if the problem was the plugin but the other theme worked perfectly. I thought it might be jquery, but with or without the default wordpress jquery (in header or footer) the result is the same.

What am I doing wrong?

Function.php

<?php

require_once('inc/redux-framework-master/redux-framework.php');
require_once('inc/office-master-theme-options.php');


add_theme_support( 'post-thumbnails', array( 'post','page' ) );

function enqueue_jquery() {

    wp_deregister_script('jquery' ); 


    wp_register_script( 
         'jquery', 
         get_template_directory_uri() . '/js/jquery.js',
         array(), 
         '1.11.1', 
         false
    );


    wp_enqueue_script( 'jquery');
} 
add_action('wp_enqueue_scripts', 'enqueue_jquery');



function enqueue_styles_scripts() {


    wp_enqueue_style(
        'style-theme',
        get_stylesheet_uri(),
        array('bootstrap-css')
    );


    wp_enqueue_style(
        'bootstrap-css',
        get_template_directory_uri() . '/css/bootstrap.min.css'
    );


    wp_enqueue_style(
        'stylish-portfolio',
        get_template_directory_uri() . '/css/css_adicional.css'
    );


    wp_enqueue_style(
        'font-awesome',
        get_stylesheet_directory_uri() . '/css/font-awesome.css'

    ); 



    wp_enqueue_script(
        'bootstrap-js',
        get_template_directory_uri() . '/js/bootstrap.min.js',null
    );


} 
add_action('wp_enqueue_scripts', 'enqueue_styles_scripts');



function wpse_ie_conditional_scripts() { ?>
    <!--[if lt IE 9]>
        <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
        <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
    <?php
}
add_action( 'wp_head', 'wpse_ie_conditional_scripts' );





require_once('wp_bootstrap_navwalker.php');
register_nav_menus( array(
     'primary' => __( 'Main Menu', 'THEMENAME' ),
) );


?>

page php.

<?php get_header(); ?>


            <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
                <div class="article">
                    <h1><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h1>
                    <p><?php echo do_shortcode('[meta_gallery_slider]'); ?></p>
                    <p><?php the_content(); ?></p>
                </div>
            <?php endwhile; else: ?>
                <div class="article">
                    <p>Error 404</p>
                </div>          
            <?php endif; ?>



        <?php get_sidebar(); ?>

<?php get_footer(); ?>

1 answer

0


I had forgotten to insert <?Php wp_footer(); ?> in the archive footer.php

https://codex.wordpress.org/Function_Reference/wp_footer

Examples

In twentyten Theme

wp-content/themes/twentyten/footer.php:

<?php
   /* Always have wp_footer() just before the closing </body>
    * tag of your theme, or you will break many plugins, which
    * generally use this hook to reference JavaScript files.
    */
    wp_footer();
?>
</body>
</html>

Literal translation:

Always have wp_footer() before closing your theme tag, or you will break many plugins, which usually use this hook to reference the javascript files

Browser other questions tagged

You are not signed in. Login or sign up in order to post.