如何在wordpress中的不同页面上发布帖子

问题描述:

我发现将帖子置于不同页面上存在困难。如何在wordpress中的不同页面上发布帖子

让我们假设我有5页和10个职位。我需要在每个页面上放置1篇文章,例如(例如第1篇文章到第1页,第2篇文章到第2页),还有一个博客部分,我只需要放置剩下的5篇文章。但博客部分会自动将所有10个帖子放入博客部分。

如何解决这个问题。任何想法都会很棒。

您可以使用此:

if (is_page()) { 
    query_posts('cat=3&year=2004'); 
} 

您可以使用此参数检查至极页你在:

is_page(); 
// When any single Page is being displayed. 

is_page(42); 
// When Page 42 (ID) is being displayed. 

is_page('Contact'); 
// When the Page with a post_title of "Contact" is being displayed. 

is_page('about-me'); 
// When the Page with a post_name (slug) of "about-me" is being displayed. 

is_page(array(42,'about-me','Contact')); 
// Returns true when the Pages displayed is either post ID 42, or post_name "about-me", or post_title "Contact". Note: the array ability was added at Version 2.5. 

也看看这个代码(由蛞蝓获得职位):

<?php 
$the_slug = 'my_slag'; 
$args=array(
    'name' => $the_slug, 
    'post_type' => 'post', 
    'post_status' => 'publish', 
    'showposts' => 1, 
    'caller_get_posts'=> 1 
); 
$my_posts = get_posts($args); 
if($my_posts) { 
echo 'ID on the first post found '.$my_posts[0]->ID; 
} 
?> 

好运