-1

我只有一个支持在全宽投资组合主页上显示投资组合项目的主题,这些投资组合项目不支持视频,但我可以在普通帖子中嵌入视频我需要做的是改变主页以显示例如分类帖子,这里是代码

<?php 

                    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
                    $showposts = $data['home_recent_number']; 

                    $args = array(
                                    'showposts' => $showposts ,
                                    'post_type' => 'portfolioentry'
                                  );

                    $my_query = new WP_Query($args);
                    $wp_query = $my_query;

                    //query_posts("showposts=$showposts&post_type=portfolioentry&paged=$paged");
                    query_posts("showposts=$showposts&post_type=portfolioentry&paged=$paged");

                    $limit_text = 100;
                    $currentindex = '';
                    $counter = 0;
                    $count = 0;
                    $temp = '';
                    while ( have_posts() ) : the_post();
                        $do_not_duplicate = $post->ID; 
                        $full_image = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'full', false);
                        $entrycategory = get_the_term_list( $post->ID, 'portfoliocategory', '', '_', '' );
                        $catstring = $entrycategory;
                        $catstring = strip_tags($catstring);
                        $catstring = str_replace('_', ', ', $catstring);
                        $categoryname = $catstring;                         
                        $entrycategory = strip_tags($entrycategory);
                        $entrycategory = str_replace(' ', '-', $entrycategory);
                        $entrycategory = str_replace('_', ' ', $entrycategory);

                        $catidlist = explode(" ", $entrycategory);
                        for($i = 0; $i < sizeof($catidlist); ++$i){
                            $catidlist[$i].=$currentindex;
                        }
                        $catlist = implode(" ", $catidlist);


                        $category = get_the_term_list( $post->ID, 'portfoliocategory', '', ', ', '' );  

                        if(isset($full_image[0]))
                            $img = get_template_directory_uri() .'/js/timthumb.php?src='.$full_image[0] .'&';
                        else
                            $img = get_template_directory_uri() .'/js/timthumb.php?src='.get_template_directory_uri() .'/images/placeholder-port.png&';

                        ?>
                            <div class="item4">



                        <a href="<?php the_permalink(); ?>">
                            <div class="overdefult">

                                <div class="viewIcon"><?php echo getPostViews(get_the_ID()); ?></div>
                                <div class="likeIcon"><?php echo GetWtiLikeCount($post->ID) ?></div>

                            </div>
                        </a>
                        <div class = "detailsoverdefault">
                            <h3><a href="<?php //the_permalink(); ?>"><?php $title = substr(the_title('','',FALSE),0,30); echo $title  ?></a></h3>
                            <a href="<?php //the_permalink(); ?>"><div class = "moreButton">+</div></a>
                        </div>
                        <div class="image">

                            <img class="newimage <?php echo $newheight ?>" src="<?php echo  $img ?>" alt="<?php the_title(); ?>">
                        </div>  

                        </div>  
                    <?php 




                    endwhile; 
                    ?>

    </div>


</div>


非常感谢。主题演示在http://key-film.com/beta/

4

2 回答 2

0

尝试这个

post_type=post

query_posts("showposts=$showposts&post_type=post&paged=$paged");
于 2012-11-21T13:58:58.407 回答
0

代替

$args = array(
    'showposts' => $showposts ,
    'post_type' => 'post', //select posts
    'paged' => $paged,
);

删除query_posts (对加载时间不利)

并将 while 循环的行替换为:

while ( $my_query->have_posts() ) : $my_query->the_post();
于 2012-11-21T14:12:49.457 回答