WordPress.org

Ready to get started?Download WordPress

Forums

Show post from custom category ids (2 posts)

  1. ahuggup86
    Member
    Posted 1 year ago #

    what am trying to do is hardcode some category ids in this function rather have it pull from the theme options instead how can i change this code to display category i add in the loop right now it displays 3 categorys with thumb, title, its excerpt from post, and three additional links below it as just links, but i want to change this so it shows categories i hardcoode in its loop how can i do that, am having an hard time getting it to work
    <?php
    $cc = 0; $c = 10; while ($cc < $c) {
    $cc++;

    unset($cat, $catlink, $loop);

    $category = 'featured_category_' . $cc;

    if (option::get($category)) {
    $cat = get_category(option::get($category),false);
    $catlink = get_category_link(option::get($category));

    $posts_num = option::get('featured_categories_posts');

    $loop = new WP_Query( array( 'post__not_in' => get_option( 'sticky_posts' ), 'posts_per_page' => $posts_num, 'orderby' => 'date', 'order' => 'DESC', 'cat' => option::get($category) ) );
    ?>

    <div class="featured_cat">

    <h3>"><?php echo"$cat->name";?> <span></span></h3>

    <?php if ( $loop->have_posts() ) :
    $x = 0;
    while ($loop->have_posts()) : $loop->the_post(); update_post_caches($posts); $x++;

    if ($x == 1)
    {
    ?>

    <?php $image = ui::getImage(220, 145);
    if ($image) { ?>
    <div class="thumb">" title="<?php printf( the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><img src="<?php echo $image; ?>" alt="<?php the_title(); ?>" />

    <?php if (option::get('display_comments') == 'on') { ?>
    <span class="bubble"><?php comments_popup_link('0', '1', '%', ' ', ' '); ?></span>
    <?php } ?>
    </div>
    <?php } ?>

    <div class="article">
    <h2 class="title">" title="<?php the_title(); ?>"><?php the_title(); ?></h2>
    <?php the_excerpt(); ?> <?php if (option::get('display_readmore') == 'on' && option::get('display_content') == 'Excerpt') { ?>"><span><?php _e('Read more', 'wpzoom'); ?> ›</span><?php } ?>
    </div>

    <?php else : ?>

    <p class="title"><?php _e('There are no posts in this category', 'wpzoom') ?></p>

    <?php endif; ?>

    </div>
    <?php } // if category is set
    } // while categories
    ?>

    <?php wp_reset_query(); ?>

  2. ahuggup86
    Member
    Posted 1 year ago #

    is there anyone that can help with this please

Topic Closed

This topic has been closed to new replies.

About this Topic