嘿,伙计们,我正在制作一个WordPress网站移动响应,我决定利用bootstrap。我成功地实现了对导航菜单和英雄部分的更改,但这一部分:
我想用bootstrap mobile responsive版本来代替它,我用这个版本做到了:
?php get_header(); ?>
<div class="container index">
<div class="row">
<div class="col-md-8">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Welcome to Three Green Birds!</h3>
</div>
<div class="panel-body">
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
<div class="date"><span class="month"><?php the_time(\'M d\') ?></span><span class="year">.<?php the_time(\'y\') ?>.d<?php the_time(\'z\') ?>/w<?php the_time(\'W\') ?></span></div>
<!--<div class="spacer"></div>-->
<div class="post-title">
<?php if (function_exists(\'get_cat_icon\')) get_cat_icon(\'class=myicons\'); ?><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></div>
<div class="spacer"></div>
<div class="post-content">
<?php the_content(\'Read the rest of this entry »\'); ?>
</div>
<div class="spacer"></div>
<div class="postmeta"><span class="postcat"><b>Categories:</b> <?php the_category(\', \') ?>
<?php the_tags(\'| <b>Tags:</b> \', \', \', \'\'); ?>
| <b>Comments:</b> <?php comments_popup_link(\'0\', \'1\', \'%\', \'\', \'Off\'); ?></span>
<span class="postcat"><?php edit_post_link(\'| <b>Edit</b>\'); ?></span>
</div>
<div class="post-footer"></div>
<?php endwhile; ?>
<div class="navigation">
<br/><br/>
<div class="alignleft"><?php next_posts_link(\'« Older Entries\') ?></div>
<div class="alignright"><?php previous_posts_link(\'Newer Entries »\') ?></div>
</div>
<?php else : ?>
<div class="post-title">Not Found</div>
<p class="post-content">Sorry, but you are looking for something that isn\'t here.</p>
<?php include (TEMPLATEPATH . "/searchform.php"); ?>
<?php endif; ?>
</div>
</div>
</div>
<div class="col-md-4">
<?php if (is_active_sidebar(\'sidebar\')) : ?>
<?php dynamic_sidebar(\'sidebar\'); ?>
<?php endif; ?>
</div>
</div>
</div>
<div class="container">
<hr>
<footer>
<p>© 2008-2017 Three Green Birds. All Rights Reserved.</p>
</footer>
</div>
<?php get_footer(); ?>
但尽管我反复清空缓存,重新启动MAMP,但旧代码不会消失。这是因为我还没有对CSS进行任何更改,以使用引导html标记吗?
下面是函数。查看正确排队的css和js脚本的php文件:
<?php
// Theme Support
function tgb_theme_support(){
// Nav Menus
register_nav_menus(array(
\'primary\' => __(\'Primary Menu\')
));
}
add_action(\'after_setup_theme\', \'tgb_theme_support\');
function bootstrap_css_js(){
wp_enqueue_style(\'bootcss\', get_template_directory_uri().\'/assets/css/bootstrap.min.css\');
wp_enqueue_style( \'stylecss\', get_stylesheet_uri(), array(), false, \'screen\' );
wp_enqueue_script(\'bootjs\', get_template_directory_uri().\'/assets/js/main.js\', array(\'jquery\'), true);
wp_enqueue_script( \'bootjs\', get_template_directory_uri().\'/assets/js/bootstrap.min.js\', array( \'jquery\' ), true );
}
add_action(\'wp_enqueue_scripts\', \'bootstrap_css_js\');