_x('FAQ Items', 'Post Type General Name', 'add-faq-on-any-page'), 'singular_name' => _x('FAQ Item', 'Post Type Singular Name', 'add-faq-on-any-page'), 'menu_name' => __('FAQ', 'add-faq-on-any-page'), 'name_admin_bar' => __('FAQ', 'add-faq-on-any-page'), 'parent_item_colon' => __('Parent Item:', 'add-faq-on-any-page'), 'all_items' => __('All Items', 'add-faq-on-any-page'), 'add_new_item' => __('Add New Item', 'add-faq-on-any-page'), 'add_new' => __('Add New', 'add-faq-on-any-page'), 'new_item' => __('New Item', 'add-faq-on-any-page'), 'edit_item' => __('Edit Item', 'add-faq-on-any-page'), 'update_item' => __('Update Item', 'add-faq-on-any-page'), 'view_item' => __('View Item', 'add-faq-on-any-page'), 'search_items' => __('Search Item', 'add-faq-on-any-page'), 'not_found' => __('Not found', 'add-faq-on-any-page'), 'not_found_in_trash' => __('Not found in Trash', 'add-faq-on-any-page'), ); $args = array( 'label' => __('FAQ Item', 'add-faq-on-any-page'), 'description' => __('Questions and answers', 'add-faq-on-any-page'), 'labels' => $labels, 'supports' => array('title', 'editor', 'revisions'), 'hierarchical' => false, 'public' => true, 'show_ui' => true, 'show_in_menu' => true, 'menu_position' => 25, 'show_in_admin_bar' => true, 'show_in_nav_menus' => true, 'can_export' => true, 'has_archive' => true, 'exclude_from_search' => false, 'publicly_queryable' => true, 'capability_type' => 'page', ); register_post_type('add_faq_onp', $args); } /** * Plug-in Shortcode init. * @param type $atts * @return string */ public function shortcode_add_faq($atts) { $args = shortcode_atts(array( 'cat' => null, 'category_name' => null, 'order' => 'DESC', 'orderby' => 'date', 'posts_per_page' => -1, 'post_type' => 'add_faq_onp' ), $atts); /*global $wp_post_types; $obj = $wp_post_types['add_faq_onp']; echo "
";
//print_r($obj);
echo $obj->description;exit;*/
$content = "";
$the_query = new WP_Query($args);
if ($the_query->have_posts()) :
$content .= "";
while ($the_query->have_posts()) :
$the_query->the_post();
$content .= '' . get_the_title() . '
';
$content .= '' . get_the_content() . '';
endwhile;
$content .= '';
wp_enqueue_style('jquery-ui-smoothness-faq');
wp_enqueue_script('add-faq-js-hadler');
else :
$content .= "No FAQ items found";
endif;
wp_reset_postdata();
return $content;
}
/*public function general_admin_notice(){
global $pagenow;
print_r($pagenow);
if ( $pagenow == 'edit.php?post_type=add_faq_onp' ) {
echo '
This notice appears on the settings page.
';
}
}*/
}
add_action('admin_footer','print_mynote');
function print_mynote(){
global $typenow,$pagenow;
if (in_array( $pagenow, array( 'edit.php')) && "add_faq_onp" == $typenow ) {
?>