true,'show_ui' => true,'label'=>'Latest News','show_in_menu'=>true]) ; } add_action('init','aidsys_news_setup_post_type'); /** Activation Hook */ function aidsys_news_activated(){ //Register latest news post type aidsys_news_setup_post_type() ; //Clear Permalinks after post type registration flush_rewrite_rules() ; } register_activation_hook(__FILE__, 'aidsys_news_activated' ); /** Deactivation Hook */ function aidsys_news_deactivated(){ //Un Register Post Type unregister_post_type( 'news' ); //Clear Permalinks flush_rewrite_rules() ; } register_deactivation_hook( __FILE__, 'aidsys_news_deactivated' ); // Register shortcode for news ticker panel function aidsys_news_ticker_panel_shortcode($atts) { // Shortcode attributes $atts = shortcode_atts(array( 'post_type' => 'news', // Default post type 'limit' => -1, // Display all posts by default ), $atts); // Query arguments $args = array( 'post_type' => $atts['post_type'], 'posts_per_page' => $atts['limit'], 'order' => 'DESC', // Display latest posts first ); // Fetch posts $query = new WP_Query($args); // Output news ticker HTML ob_start(); // Start output buffering ?>