1
我想顯示某個類別的帖子到顯示縮略圖的頁面,然後鏈接到完整的帖子。這將成爲案例研究部分。僅顯示來自一個類別的wordpress帖子
我有鏈接顯示並帶我通過,但它顯示所有帖子,而不是像我想要的特定類別。
任何想法?我不熟悉PHP和只使用WordPress
剛纔所說我的代碼:
<?php // PAGE LINK/TITLE
if (is_page()) {
$cat=get_cat_ID($post->post_title); //use page title to get a category ID
$posts = get_posts ("cat=$cat&showposts=10");
if ($posts) {
foreach ($posts as $post):
setup_postdata($post);
if (has_post_thumbnail()) { // PULLS IN IMAGE check if the post has a Post Thumbnail assigned to it.
the_post_thumbnail();
}
?>
<h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
<?php //PULLS IN EXCERPT
$my_excerpt = get_the_excerpt();
if ('' != $my_excerpt) {
// Some string manipulation performed
}
echo $my_excerpt; // Outputs the processed value to the page
?>
<?php endforeach;
}
}
?>
哪個模板要覆蓋? –
裸體worpdress主題 – 5kud
我問的是哪個模板(page.php,index.php,archive.php,content.php等),而不是詢問主題? –