[英]Problem with blog posts in integrating wordpress with existing site.
我試圖將wordpress集成到現有站點中,所以將wordpress文件放在Localhost / site / blog目錄中,因為我不想將根目錄與所有include / stylesheet / images文件夾混在一起。
而且我還希望該博客模仿我的網站的設計。 這就是為什么我只是創建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目錄中還是在我的根目錄中? 如果您還有其他疑問或疑問不明確。 請告訴我。 謝謝
最可能的原因是singe.php和page.php已經存在。
您應該將設置中的URL更改為localhost / site / blog
您可以在這里找到更多信息: http : //codex.wordpress.org/Giving_WordPress_Its_Own_Directory
single.php
(用於發布) page.php
(用於通用頁面)應位於/wp-content/themes/<active theme>/
目錄中。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.