감사합니다 도움.
내가 말했듯이, 나는 site.com/blog
에 Wordpress를 설치했으며, site.com의 홈페이지 (index.php
)에 페이지의 "News"섹션에 3 개의 Wordpress 게시물을 표시하고 싶습니다.
그래서 site.com 내가 추가했다 :
<div id="news">
<p>Here you can see our latest News</p>
<?php
define('WP_USE_THEMES', false);
require('blog/wp-blog-header.php'); //Note the folder hierarchy to find wp-blog-header.php
?>
<?php
$my_query = new WP_Query('showposts=3'); //"3" being the number of posts to be shown
while ($my_query->have_posts()): $my_query->the_post();
?>
<h3><?php the_title() ?></h3> //This makes the post title show inside a h3 tag
<p><?php the_excerpt() ?></p> //This makes the post excerpt show inside a p tag
<?php endwhile;
?>
</div>
당신이 – Marcin
는 모든 게시물을 표시 하시겠습니까 다른 웹 사이트에서 데이터를 가져 오기 위해 jQuery의 AJAX를 사용할 수 있습니까? –
Marcin, 나는 Wordpress가 자체 PHP 함수를 가지고 있으므로 jQuery 사용을 피하고 싶습니다. ChemistryBlob, 아니요, 최근의 것들! 배열을 사용해야 할거야, 그렇지? 마찬가지로, 3은 좋은 시작이 될 것입니다. –