我正在創建我的第一個主題,它的工作正常。主題Wordpress不顯示插件的內容短代碼
但是,當我安裝了2個插件並在我的主題中插入短代碼時,網站上沒有任何內容出現。
我已經選擇了另一個主題,它通常工作的插件,可能會發生什麼?
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/stylish-portfolio.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(); ?>
的HTMLS和畫廊圖像的SRC代碼顯示在控制檯,但屏幕應該顯示的位置變白圖像
這很可能是你的jQuery覆蓋導致問題。你爲什麼'註銷'jQuery?請使用WP附帶的jQuery。你的'page.php'模板看起來是正確的,**假設**這是你遇到問題時正在渲染的模板。 –
@cale_b默認的wordpress Jquery被添加到頭文件中並且引導程序沒有工作,我無法註冊jquery的另一個版本以使引導程序正常工作,所以我只是通過取消註冊默認的jquery來設法啓動引導程序。而且我也不能把默認的jquery放在頁腳 – Gislef
上,我根據你的建議做了。我試圖使用默認的jquery,但它沒有添加到標題中,所以插件還沒有出現在頁面上,並且引導程序也沒有工作 – Gislef