Mingle Forum
Changing the Recent Post Widget to only show posts from one subforum? (2 posts)

  1. Reacto
    Posted 4 years ago #

    Is it possible to do this? Want a sidebar box like the recent post one, but so it only shows new posts from one forum, with an edited title. Like, have a forum for new cups, then call the sidebar widget box New cups and make it only show posts from the "Cups" subforum? Any way to do this?


    [ Please do not bump, it's not permitted here. ]

  2. luuthang
    Posted 3 years ago #

    Hi, you can try as follow

    Add this funtion

    function latest_threads_in_forum($forum = 1, $num = 5, $ul = true){
    		global $wpdb;
    		$toShow = 0;
    		$posts = $wpdb->get_results("SELECT * FROM $this->t_threads WHERE parent_id=$forum ORDER BY <code>date</code> DESC LIMIT 50");
    		if($ul) echo "<ul class='forumtwo'>";
    		foreach($posts as $post){
    			if($toShow < $num)
    				//$user = get_userdata($post->author_id);
    					echo "<li class='forum'><a href='".$this->get_paged_threadlink($post->parent_id, '#postid-'.$post->id)."'>".$this->output_filter($post->subject)."</li>";
    				$toShow += 1;
    		if($ul)echo "</ul>";

    Add this function

    function latest_threads_in_forum($forum = 1){
    	global $mingleforum;
    	return $mingleforum->latest_threads_in_forum($forum);

    --In template file (sidebar.php)

    <?php latest_threads_in_forum(2, 5, true); ?>

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic


No tags yet.