Skip to content

Instantly share code, notes, and snippets.

@ntwb
Last active January 1, 2016 15:59
Show Gist options
  • Save ntwb/8167699 to your computer and use it in GitHub Desktop.
Save ntwb/8167699 to your computer and use it in GitHub Desktop.
bbPress - Custom Views
<?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' );
@alessandrodegiusti
Copy link

Y donde se muestran las listas?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment