WordPress.org

Ready to get started?Download WordPress

Forums

Need Help with Triangle Template and get_posts (6 posts)

  1. maddysayz
    Member
    Posted 1 year ago #

    Dears,

    I am building this website using Triangle Magazine template and I am having this weird problem that is getting on my nerves. I wanted to make 6 pods on the homepage belonging to 6 categories and wanted to have the latest posts from each show there.

    I did that by writing the following code:

    $post_ids = array(0);
    			foreach( array(9,10,13,14,15,16) as $cat_id ) {
    					if ( $posts = get_posts(array('category' => $cat_id, 'numberposts' => 1)) ) {
    							$first = array_shift($posts);
    							$post_ids[] = $first->ID;
    					}
    			}
    			query_posts(array('post__in' => $post_ids));

    The problem is that the code is displaying Ids though I have no echo anywhere. Please have me out here guys.

    Regards,

    Maddy

  2. Andrew
    Forum Moderator
    Posted 1 year ago #

    Maddy,
    Whereabouts did you get this theme from?

  3. maddysayz
    Member
    Posted 1 year ago #

    Purchased it from themeforest.com. I am pretty sure it is not a theme issue but something with respect to get_posts.

  4. Scott Kingsley Clark
    Member
    Posted 1 year ago #

    Definitely something wrong here, based on the code you've posted, that's certainly not expected.

  5. maddysayz
    Member
    Posted 1 year ago #

    Yup that is the issue. No echo anywhere. Still the Ids are being displayed :( :( :(

  6. Scott Kingsley Clark
    Member
    Posted 1 year ago #

    Contact your theme author on themeforest.com, they will get you taken care of. We can't help you here, you paid for the theme and you're entitled to support from the author directly hopefully.

Topic Closed

This topic has been closed to new replies.

About this Topic