• Hi All,

    This is probably simple. I am trying to make a list with just things that are newly added. But not include edited old entries that are newly edited. I think this code is adding to the list the newest published articles. I do not want the newest published articles. I want it to list just the “newest issue” Like after issue 50, I post new posts with the category Issue 51, then 50 should dissapear.Heres my code what do you think?

    <?php
    // home.php - template for the front page
    // OPF theme for WordPress by ___________
    
    // function to get an index listing for the latest issue
    // automagically updated to the latest issue, every time one is published
    function opfLatestIssueIndex() {
    	global $wpdb;
    
    	// first we determine which category corresponds to the latest issue
    	// the parent category that holds all issues has ID 3
    	// every time we add a new issue, it gets a higher ID,
    	// so we want the highest ID that has as its parent ID 3
    	$issueCatsSql = "SELECT cat_id FROM <code>opf2_categories</code> WHERE category_parent=3 ORDER BY cat_id DESC";
    	$issueCatIDs = array();
    	$issueCatIDs = $wpdb->get_col($issueCatsSql);
    	$latestIssueID = $issueCatIDs[0]; // the first one in the descending list is the latest
    
    	// then we let the plugin produce this as a nice index list
    	c2c_get_recent_posts ($num_posts = 25,
    				$format = "<li>%post_URL%</li>",
    				$categories = $latestIssueID, // category ID of latest issue
    				$orderby = 'date',
    				$order = 'ASC');
    }
Viewing 1 replies (of 1 total)
  • Thread Starter mkwick

    (@mkwick)

    Sorry, forgot this part of the code.

    <h4>Issues</h4>
    <ul>
    	<?php 
    
    	$sql_opf_post = 'SELECT ID, post_title FROM <code>opf2_posts</code> WHERE post_status = \'publish\' ORDER BY <code>ID</code> DESC LIMIT 12;';
    	$res = mysql_query($sql_opf_post) or die (mysql_error());
    
    	while($row = mysql_fetch_array($res)) {
    	echo "<li>";
    	echo "<a href=?p=".$row['ID'].">".$row['post_title']."</a>";
    	echo "</li>";
    	}
    	?>
Viewing 1 replies (of 1 total)
  • The topic ‘All newest posts showing up in list. Just want newest cateory’ is closed to new replies.