-
-
Save prabin04/437dccdf55b5e3192053 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: bbPress - Custom Views | |
Plugin URI: https://gist.github.com/ntwb/8167699 | |
Description: bbPress - bbPress - Custom Views | |
Version: 0.1 | |
Author: Stephen Edgar - Netweb | |
Author URI: http://netweb.com.au | |
*/ | |
/** | |
* Register these bbPress views: | |
* - Popular Topics | |
* - Unpopular Topics | |
* - Random Topic | |
* - Recently Closed | |
* - Tagged Test | |
* - All Topics | |
* - Open (Not Closed) | |
* - Random Single Topic | |
* | |
* @uses bbp_register_view() To register the view | |
*/ | |
function ntwb_register_custom_views() { | |
bbp_register_view( 'popular-topics', __( 'Popular Topics' ), array( 'meta_key' => '_bbp_reply_count', 'orderby' => 'meta_value_num' ), false ); | |
bbp_register_view( 'unpopular-topics', __( 'Unpopular Topics' ), array( 'meta_key' => '_bbp_reply_count', 'orderby' => 'meta_value_num', 'order' => 'asc' ), false ); | |
bbp_register_view( 'random-topic', __( 'Random Topic' ), array( 'orderby' => 'rand' ), false ); | |
bbp_register_view( 'closed', __( 'Recently Closed' ), array( 'post_status' => 'closed' ), false ); | |
bbp_register_view( 'taggedtest', __( 'Tagged Test' ), array( 'topic-tag' => 'test' ) ); | |
bbp_register_view( 'all-topics', __( 'All Topics' ), array( 'order' => 'DESC' ), false ); | |
bbp_register_view( 'open', __( 'Open (Not Closed)' ), array( 'post_status' => 'publish' ), false ); | |
bbp_register_view( 'random-single-topic', __( 'Random Single-Topic' ), array( 'orderby' => 'rand', 'posts_per_page' => '1', 'max_num_pages' => '1' ), false ); | |
} | |
add_action( 'bbp_register_views', 'ntwb_register_custom_views' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment