Support » Plugins » Hacks » get only the latest post from all my network site

  • Resolved sugarFornaciari


    Hi Guys,
    I am here to ask some help in order to succeed in this development.

    I am trying to get only the most recent article from all the articles I have on the netword. I wish use code. No plugin and at the moment what I have done it is publish the latest post from each blog.

    In other word I need help just to select and publish the article most recent from a list of recent articles.

    Here the code

    [Code moderated as per the Forum Rules. Please use the pastebin]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Inside the function there is comment:
    // here I have the recent post for each blog

    This is the place where it is possible get the recent post from each blog.
    So My idea is that I could store this data and order by most recent data.

    Could anyone help?

    Hi Guys I have solved…
    Ok having the list of recent articles of all the network that you may build yourself by reading here

    and here

    you can put every thing in an array and after that sorting dates with this function that give the most recent date

    $mostRecent= 0;
    	$date_c =0;
    	$post_c =0;
    	foreach($post_date_ar as $date){
    	  $curDate = strtotime($date);
    	  if ($curDate > $mostRecent) {
    		 $mostRecent = $curDate;
    			$post_c = $c;

    and after that, i will use this info to get the item from the list of post

    $recent_post_c = 0;
    	foreach($recent_post_ar as $post) : setup_postdata($post);
    		<div <?php post_class() ?> id="post-<?php the_ID(); ?>">
    <h2><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h2>
    <?php the_content(); ?>
    		<hr />

    The code is not very elegant but it works…

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘get only the latest post from all my network site’ is closed to new replies.