How I implement Dashboard templates
-
Hi!
I have several dashboards that should have diferent templates by post_type. So I have to hack plugin files to reach this. I add new function to wpuf-functions.php:
function wpuf_load_dashboard( $args = array() ) { if ( $args && is_array( $args ) ) extract( $args ); $file = locate_template( array( 'wpuf/dashboard-' . $post_type . '.php', 'wpuf/dashboard.php' ) ); $wpuf_dir = WPUF_ROOT . '/templates/'; if ( file_exists( $file ) ) { include $file; } else { include $wpuf_dir . $file; } }
and change wpuf_load_template in frontend-dashboard.php with this:
wpuf_load_dashboard( array( 'post_type' => $post_type, 'userdata' => wp_get_current_user(), 'dashboard_query' => $dashboard_query, 'post_type_obj' => $post_type_obj, 'post' => $post, 'pagenum' => $pagenum ) );
Now I can create files in my template directory like this “dashboard-works.php” and code dashboard only for “works” post type.
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘How I implement Dashboard templates’ is closed to new replies.