Wordpress Themes - WP Forum at BFA
There will be no more development for Atahualpa (or any other theme), and no support. Also no new registrations. I turned off the donation system. I may turn the forum to read only if it gets abused for spam. Unfortunately I have no time for the forum or the themes. Thanks a lot to the people who helped in all these years, especially Larry and of course: Paul. Take care and stay healthy -- Flynn, Atahualpa developer, Sep 2021

Wordpress Themes - WP Forum at BFA » WordPress Themes » Atahualpa 3 Wordpress theme » Plugins & Atahualpa »

Most Recent Posts Slider: Pull From Each Category


  #1  
Old Sep 13, 2012, 09:21 AM
theadventurebite
 
136 posts · May 2010
Most Recent Posts Slider: Pull From Each Category

Okay so I finally figured out how to get the most recent post from multiple categories to pull properly.

This is the most basic of basic index.php to do this and pull it into the loop.

Code:
<?php
get_header();
?>
      <div id="content">
      <?php
  // array of category IDs
  $categories =  array(4, 5, 6);

  foreach ($categories as $cat) :
    $post = false;
    $post = get_posts('cat='.$cat.'&posts_per_page=1');
    if($post) :
      $post = $post[0];
      setup_postdata($post);
       get_template_part('content',get_post_format());
      ?>
    <?php endif; ?>
  <?php endforeach; ?>
      </div>
   
  <?php get_sidebar(); ?>
   <?php get_footer(); ?>
What I am trying to do is get the Most Recent Posts Slider to have this functionality.

I am so basic at php that I am struggling to know where to take this code and insert it.

I know it's not a ton but I would be willing to donate $10 to anyone who can help me get this put where it needs to go.

Thanks!

Dani
  #2  
Old Sep 13, 2012, 09:28 AM
theadventurebite
 
136 posts · May 2010
I do not need it to function in the output fields in the Setting areas or have that aspect cleaned up after removing other variables, etc. I just need it to function properly, I can handle editing categories that are pulled etc, if I ever need to change them in the code itself.

Thanks

Bookmarks



Similar Threads
Thread Thread Starter Forum Replies Last Post
Exclude category from Recent Posts in sidebar paulae Sidebars & Widgets 17 Apr 9, 2013 08:34 AM
Recent Post Slider PRES Center area post/pages 1 Mar 15, 2012 01:00 PM
[SOLVED] Recent posts of same category, on single post pages GeoParadise Atahualpa 3 Wordpress theme 10 Apr 19, 2010 08:54 AM
[SOLVED] Removing a Post from the Recent Posts Category Chloe Sidebars & Widgets 3 Mar 17, 2010 01:06 PM
[SOLVED] Is there a way to automatically pull out certain posts onto a new page lotusblossomk Atahualpa 3 Wordpress theme 2 Nov 12, 2009 06:01 AM


All times are GMT -6. The time now is 08:29 PM.


Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.