【发布时间】:2013-11-19 19:33:27
【问题描述】:
我正在尝试将 wordpress 集成到我现有的站点中,因此我将 wordpress 文件放在 Localhost/site/blog 目录中,因为我不想在包含所有包含/样式表/图像文件夹的情况下弄乱我的根目录。
我还希望博客模仿我网站的设计。这就是为什么我刚刚创建了 blog.php 并将其放在根目录中,然后将它放在我的 blog.php 之上,这样 wordpress 就可以与 blog.php 一起使用。即使它不在 wordpress 目录中。
<?php
define('WP_USE_THEMES', false);
require('./blog/wp-blog-header.php');
?>
然后我把循环放在body标签里面,一切看起来都很好。博客文章出现。它们完美对齐。
<!-- Start the Loop. -->
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<?php if ( in_category('3') ) { ?>
<div class="post-cat-three">
<?php } else { ?>
<div class="blogpostcontainer">
<div class="blogpost">
<div><img src="images/blogpost_picture.jpg" width="125" height="125" alt="blogpost" /></div>
<div class="info">
<?php } ?>
<!-- Display the Title as a link to the Post's permalink. -->
<h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
<?php the_excerpt(); ?>
<p><span class="date"><?php the_time('F jS, Y') ?> by <?php the_author_posts_link() ?></span></p>
</div><!--END OF info div-->
</div><!--END OF blogpost div-->
</div><!--END OF blogpostcontainer div-->
<?php endwhile; else: ?>
现在的问题! 好吧,问题是,每当我尝试单击帖子的永久链接(查看整篇帖子)时,我都会得到一团糟:那里的一切都没有任何 CSS 或任何东西。
我只是想知道,我怎样才能让帖子看起来不错,我知道我必须创建 single.php 或 page.php?(或者我是吗?),但我不知道放在哪里。它是在 wp 目录中,还是在我的根目录中? 如果您还有问题或问题含糊不清。请告诉我。谢谢
【问题讨论】: