dregvw1801 2014-02-03 08:43
浏览 16

在Wordpress主页上只显示一个类别

I have a user review site built with Wordpress and can't seem to get just one category to show on home page.

I have tried:

<?php get_header(); ?>
<?php $top_counter=1 ?>
<?php
    $blog_hero = of_get_option('blog_hero');
    if ($blog_hero && ! is_category()){
?>

<div class="clearfix row-fluid">
    <div class="hero-unit">
        <h3>thanks stack-exchange help needed.</p>
        <br />
        </p>
    </div>
</div>

<?php
    }
?>

<div id="content" class="clearfix row-fluid">
    <div id="main" class="span8 clearfix" role="main">
        <? function customf_process_wp_query($posts_data,$post_type=null,$post_rate=null){

            wp_reset_query();
            query_posts($posts_data);

        ?>

        <?php if (have_posts()) : while (have_posts()) : the_post(); ?>

        <?php

            if($post_type==3){
                $in_top=false;
                foreach($post_rate as $key=>$top_post_id){
                if($top_post_id->ID==get_the_ID()) $in_top=true;
            }
            if($in_top) continue;
            }
        ?>

        <article id="post-<?php the_ID(); ?>" <?php post_class('clearfix'); ?> role="article">
        <header>
  • 写回答

2条回答 默认 最新

  • doule6314 2014-02-03 10:18
    关注
    query_posts( array('your-custom-taxonomy' => 'category name', 'post_type' => 'your_post_type_here') );
    

    replace the above code with

    query_posts($posts_data);
    

    and replace your-custom-taxonomy and your_post_type_here with required arguments. Hope this will help

    评论

报告相同问题?

悬赏问题

  • ¥15 多址通信方式的抗噪声性能和系统容量对比
  • ¥15 winform的chart曲线生成时有凸起
  • ¥15 msix packaging tool打包问题
  • ¥15 finalshell节点的搭建代码和那个端口代码教程
  • ¥15 用hfss做微带贴片阵列天线的时候分析设置有问题
  • ¥15 Centos / PETSc / PETGEM
  • ¥15 centos7.9 IPv6端口telnet和端口监控问题
  • ¥20 完全没有学习过GAN,看了CSDN的一篇文章,里面有代码但是完全不知道如何操作
  • ¥15 使用ue5插件narrative时如何切换关卡也保存叙事任务记录
  • ¥20 海浪数据 南海地区海况数据,波浪数据