我怎么能在类别基地做特色的后期展示

时间:2013-06-16 07:00:01

标签: php javascript html wordpress

我在1个div id,1个大班和1个小班中有2个精选帖子。我希望大特色div在类别基础上发布..大特色邮政编码显示在下面。

<div class="main_feat">    
            <?php get_the_image( array( 'size' => 'featured',  'width' => 310, 'before' => '<div class="thumb">', 'after' => '</div>' ) );  ?>    
            <h2><a href="<?php the_permalink(); ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a> </h2>
            <div class="date"><?php if (option::get('featured_date_format') == 'time ago') { echo time_ago(); } else { printf('%s, %s', get_the_date(), get_the_time()); } ?></div>    
            <div class="content">
                <div class="entry">
                    <?php the_excerpt(); ?>    
                    <div class="meta">
                        <a href="<?php the_permalink(); ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>" class="nextActions"><?php _e('সম্পূর্ন অংশটুকু', 'wpzoom'); ?> &rarr;</a>                            <span class="comments"><?php comments_popup_link('0', '1', '%'); ?></span><div class="clear"></div>
                    </div>    
                </div><!-- /.entry -->   
            </div><!-- /.content -->
    </div>

我想做这个div类的类别。假设我有一个类别名称。我想做这个特色类别基础。

以下精选完整代码显示...

<div id="featured">
    <?php
    $featured = new WP_Query( array(
        'showposts' => option::get('featured_art_number'),
        'post__not_in' => get_option('sticky_posts'),
        'meta_key' => 'wpzoom_is_featured',
        'meta_value' => 1
    ) );
    if ($featured->post_count > 0) : $i = 0;
    while( $featured->have_posts() ) { $featured->the_post(); global $post; $i++;
    if ($i == 1)
        { ?>
        <div class="main_feat">
            <?php get_the_image( array( 'size' => 'featured',  'width' => 310, 'before' => '<div class="thumb">', 'after' => '</div>' ) );  ?>
            <h2><a href="<?php the_permalink(); ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a> </h2>
            <div class="date"><?php if (option::get('featured_date_format') == 'time ago') { echo time_ago(); } else { printf('%s, %s', get_the_date(), get_the_time()); } ?></div>
            <div class="content">
                <div class="entry">
                    <?php the_excerpt(); ?>
                    <div class="meta">
                        <a href="<?php the_permalink(); ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>" class="nextActions"><?php _e('সম্পূর্ন অংশটুকু', 'wpzoom'); ?> &rarr;</a>
                        <span class="comments"><?php comments_popup_link('0', '1', '%'); ?></span><div class="clear"></div>
                    </div>
                </div><!-- /.entry -->
            </div><!-- /.content -->
        </div>
        <div class="headings">
            <ul>
    <?php } else { ?>
                <li>
                    <h2><a href="<?php the_permalink() ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h2>
                    <?php get_the_image( array( 'size' => 'featured-small', 'width' => 100, 'height' => 75, 'before' => '<div class="post-thumb">', 'after' => '</div>' ) ); ?>
                    <?php the_content_limit(option::get('featured_excerpt')); ?>
                    <div class="clear"></div>

                    <div class="meta">
                        <?php printf('%s, %s', get_the_date(), get_the_time()); ?>
                        <span class="comments"><?php comments_popup_link('0', '1', '%'); ?></span>
                    </div>
                </li>
                <?php }
                $i ++; } ?>
            </ul>
        </div>
    <?php endif; ?>
    <?php wp_reset_query(); ?>
    <div class="clear"></div>
</div> <!-- /#featured -->
<div class="clear"></div>

1 个答案:

答案 0 :(得分:1)

您可以在想要使用div的地方使用此代码...

<?php query_posts('orderby=name&order=asc&cat=43&showposts=100'); ?>  
<?php while (have_posts()) : the_post(); ?> ">
<?php the_title(); ?> <?php endwhile;?>

我认为这将有效......