Latest Discussion Page
-
How do I make Latest Discussion on it’s own page?
-
Hi gerikg,
this post could help you:
https://bbpress.org/forums/topic/create-a-new-custom-page-like-wordpress
1. Make a custom page
create a page discussion.php in the root forum folder
add require_once(‘./bb-load.php’); on the top of the page. and write whatever code you want in the page.. that should create a static page with bbpress functions..
2. Put in the code for the Latest discussions from the main page (?)
or
3. Make your own sql query – https://bbpress.org/forums/topic/create-a-new-custom-page-like-wordpress
Markus
Any way to do it via plugin folder, functions.php, or theme folder without putting the file in the root? If bbpress upgrades (don’t laugh too hard) I will forget about it.
Okay here is the update:
I created discussion.php and put it in root. In the file I put…
<?php
require('./bb-load.php');
bb_repermalink();
$bb_db_override = false;
do_action( 'bb_index.php_pre_db' );
if ( isset($_GET['new']) && '1' == $_GET['new'] ) :
$forums = false;
elseif ( !$bb_db_override ) :
$forums = bb_get_forums(); // Comment to hide forums
if ( $topics = get_latest_topics( false, $page ) ) {
bb_cache_last_posts( $topics );
}
if ( $super_stickies = get_sticky_topics() ) {
bb_cache_last_posts( $super_stickies );
}
endif;
bb_load_template( 'discussion.php', array('bb_db_override', 'super_stickies') );
?>It’s the same as index.php except for the last line I put discussion.php
Then I created the template file discussion.php. I put in the file:
<?php bb_get_header(); ?>
<?php if ( $forums ) : ?>
<div id="discussions">
<?php if ( $topics || $super_stickies ) : ?>
<h2><?php _e('Latest Discussions'); ?></h2>
<table id="latest">
<tr>
<th><?php _e('Topic'); ?> — <?php bb_new_topic_link(); ?></th>
<th><?php _e('Posts'); ?></th>
<!-- <th><?php _e('Voices'); ?></th> -->
<th><?php _e('Last Poster'); ?></th>
<th><?php _e('Freshness'); ?></th>
</tr>
<?php if ( $super_stickies ) : foreach ( $super_stickies as $topic ) : ?>
<tr<?php topic_class(); ?>>
<td><?php bb_topic_labels(); ?> <big><a href="<?php topic_link(); ?>"><?php topic_title(); ?></a></big><?php topic_page_links(); ?></td>
<td class="num"><?php topic_posts(); ?></td>
<!-- <td class="num"><?php bb_topic_voices(); ?></td> -->
<td class="num"><?php topic_last_poster(); ?></td>
<td class="num"><a href="<?php topic_last_post_link(); ?>"><?php topic_time(); ?></a></td>
</tr>
<?php endforeach; endif; // $super_stickies ?>
<?php if ( $topics ) : foreach ( $topics as $topic ) : ?>
<tr<?php topic_class(); ?>>
<td><?php bb_topic_labels(); ?> <a href="<?php topic_link(); ?>"><?php topic_title(); ?></a><?php topic_page_links(); ?></td>
<td class="num"><?php topic_posts(); ?></td>
<!-- <td class="num"><?php bb_topic_voices(); ?></td> -->
<td class="num"><?php topic_last_poster(); ?></td>
<td class="num"><a href="<?php topic_last_post_link(); ?>"><?php topic_time(); ?></a></td>
</tr>
<?php endforeach; endif; // $topics ?>
</table>
<?php bb_latest_topics_pages( array( 'before' => '<div class="nav">', 'after' => '</div>' ) ); ?>
<?php endif; // $topics or $super_stickies ?>
</div>
<?php else : // $forums ?>
<div class="bbcrumb"><a href="<?php bb_uri(); ?>"><?php bb_option('name'); ?></a> » <?php _e('Add New Topic'); ?></div>
<?php post_form(); endif; // $forums ?>
<?php bb_get_footer(); ?>Now bb_new_topic_link() & topic_class() for sticky does not work.
Hi gerikg,
I will test it tomorrow on my new server (playground for bbPress, Plugins, Themes) …
Markus
Anyone else can help with this?
all i did was a did a link to: view.php?view=latest
It works without anything else required.
@rich pedley When I do view.php?view=latest it goes back to the front page. Are you using a certain plugin?
no, but I did download the trunk recently (whatever version that is)
I have 1.1-alpha installed and no go!
so sad.
Using My Views plugin by _ck_ and activating its module named “Started/Participated Topics”, you will end up with a view named “Latest Discussions” which is exactly what you’re looking for.
awesome, works perfectly with the plugin.
Best Answer: mr_pelle https://bbpress.org/forums/topic/latest-discussion-page#post-69723
- You must be logged in to reply to this topic.