• Hello all,

    my site : https://www.allhorsedirect.com/dev/

    I am currently working on a classifieds website and I wish to display a list of recent posts in the sidebar that display from only 1 classified category of my choice. I am not a PHP professional but do know the basics, unfortunately the support from the theme creator is very unhelpful.

    The theme I downloaded came with the ability to display the homepage ‘news’ articles in the (right hand) sidebar only and I wish to change it to show recent posts from a different category. I would also ideally wish to show the main image for each post next to the text, this is easy for news posts as I upload the images but for the classifieds the user submits an image.

    I have looked at a few plugins and as the theme is customised they do not do the job.

    The code for the current sidebar recent posts is :

    function get_write_posts()
    {
    	$tbl = get_prefix().'posts';
    	$s = "select * from ".$tbl." where post_type='post' AND is_ad_88='0' order by post_date desc limit 3";
    	$r = mysql_query($s);
    	$res = '';
    		$is_this_ad = isAd($id);
    		$icon       = get_icon_for_post($id);
    		$imgg       = '<img class="border_img" src="'.$icon.'" alt="image_ad" />'; 
    
    	while($row = mysql_fetch_object($r))
    	{
    			$res.= '<div class="sidebar_box"><ul><li><h1><a href="'.get_permalink($row->ID).'">'.$row->post_title.'</a></h1><p>';
    			$res.= ''.substr($row->post_content,0,250).'...</p></li>';
    			$res .='</div>';
    			$class = " class='col_featured' ";
    			$imgg  = '<img class="border_img" src="'.$icon.'" alt="featured" /></div>'; 
    
    	}
    	if(mysql_num_rows($r) == 0)
    	$res = 'No articles posted yet.';
    
    	return ''.$res;
    }

    Any help will be very much appreciated, please shout if I need to post anything else.

  • The topic ‘Latest topics in single category help’ is closed to new replies.