'', // Unused. Messages start at index 1. 1 => sprintf( __( 'FAQ updated. View staff' ), esc_url( get_permalink( $post_ID ) ) ), 2 => __( 'Custom field updated.' ), 3 => __( 'Custom field deleted.' ), 4 => __( 'FAQ updated.' ), /* translators: %s: date and time of the revision */ 5 => isset( $_GET['revision'] ) ? sprintf( __( 'FAQ restored to revision from %s' ), wp_post_revision_title( ( int ) $_GET['revision'], false ) ) : false, 6 => sprintf( __( 'FAQ published. View FAQ' ), esc_url( get_permalink( $post_ID ) ) ), 7 => __( 'FAQ saved.' ), 8 => sprintf( __( 'FAQ submitted. Preview FAQ' ), esc_url( add_query_arg( 'preview', 'true', get_permalink( $post_ID ) ) ) ), 9 => sprintf( __( 'FAQ scheduled for: %1$s. Preview FAQ' ), // translators: Publish box date format, see http://php.net/date date_i18n( __( 'M j, Y @ G:i' ), strtotime( $post->post_date ) ), esc_url( get_permalink( $post_ID ) ) ), 10 => sprintf( __( 'FAQ draft updated. Preview FAQ' ), esc_url( add_query_arg( 'preview', 'true', get_permalink( $post_ID ) ) ) ), ); return $messages; } /** * Add the post-type icon to the admin screen * * @since 0.9 */ function faq_post_type_admin_image() { printf( '', ACF_URL . 'images/faq-32x32.png' ); } /** * Choose the specific columns we want to display * * @param array $columns * @return string $columns * @since 0.9 * @version 1.2 */ function faq_columns_filter( $columns ) { $columns = array( "cb" => "", "title" => __( 'FAQ Title', 'acf' ), "faq_content" => __( 'Answer', 'acf' ), 'faq_groups' => __( 'Group', 'acf' ), "date" => __( 'Date', 'acf' ) ); return $columns; } /** * Filter the data that shows up in the columns we defined above * * @global type $post * @param type $column * @since 0.9 * @version 1.1 */ function faq_column_data( $column ) { global $post; switch( $column ) { case "faq_content": the_excerpt(); break; case "faq_groups": echo get_the_term_list( $post->ID, 'group', '', ', ', '' ); break; default: break; } } /** * Add the Post type to the "Right Now" Dashboard Widget * * @link http://bajada.net/2010/06/08/how-to-add-custom-post-types-and-taxonomies-to-the-wordpress-right-now-dashboard-widget * @version 1.0 */ function faq_right_now() { // Define the post type text here, allowing us to quickly re-use this code in other projects $ac_pt = 'faq'; // must be the registered post type $ac_pt_p = 'FAQs'; $ac_pt_s = 'FAQ'; // No need to modify these 2 $ac_pt_pp = $ac_pt_p . ' Pending'; $ac_pt_sp = $ac_pt_s . ' Pending'; $args = array( 'public' => true, '_builtin' => false ); $output = 'object'; $operator = 'and'; $num_posts = wp_count_posts( $ac_pt ); $num = number_format_i18n( $num_posts->publish ); $text = _n( $ac_pt_s, $ac_pt_p, intval( $num_posts->publish ) ); if( current_user_can( 'edit_posts' ) ) { $num = "$num"; $text = "$text"; } echo '' . $num . ''; echo '' . $text . ''; echo ''; if( $num_posts->pending > 0 ) { $num = number_format_i18n( $num_posts->pending ); $text = _n( $ac_pt_sp, $ac_pt_pp, intval( $num_posts->pending ) ); if( current_user_can( 'edit_posts' ) ) { $num = "$num"; $text = "$text"; } echo '' . $num . ''; echo '' . $text . ''; echo ''; } $faq_args = array( 'name' => 'group' ); $taxonomies = get_taxonomies( $faq_args, $output, $operator ); foreach( $taxonomies as $taxonomy ) { $num_terms = wp_count_terms( $taxonomy->name ); $num = number_format_i18n( $num_terms ); $text = _n( $taxonomy->labels->singular_name, $taxonomy->labels->name, intval( $num_terms ) ); if( current_user_can( 'manage_categories' ) ) { $num = "$num"; $text = "$text"; } echo '' . $num . ''; echo '' . $text . ''; } } /** * Adds a widget to the dashboard. * * @since 1.0.3 * @version 1.1 */ function faq_register_dashboard_widget() { wp_add_dashboard_widget( 'ac-faq', 'Arconix FAQ', 'dashboard_widget_output' ); } /** * Add a widget to the dashboard * * @since 1.0 * @version 1.1 */ function dashboard_widget_output() { echo '
'; wp_widget_rss_output( array( 'url' => 'http://arconixpc.com/tag/arconix-faq/feed', // feed url 'title' => 'Arconix FAQ', // feed title 'items' => 3, // how many posts to show 'show_summary' => 1, // display excerpt 'show_author' => 0, // display author 'show_date' => 1 // display post date ) ); echo '
'; // handle the styling echo ''; }