'post', 'posts_per_page' => 5, // Change as needed. 'order' => 'DESC', 'orderby' => 'date', ) ); if ( $query->have_posts() ) { ob_start(); echo '
'; echo '
'; while ( $query->have_posts() ) { $query->the_post(); echo '
' . esc_html( get_the_title() ) . '
'; } echo '
'; echo '
'; wp_reset_postdata(); return ob_get_clean(); } return '

No news available.

'; } add_shortcode( 'aistma_scroller', 'aistma_scrolling_bar' ); /** * Shortcode for AdSense integration. * * @param array $atts Shortcode attributes. * @return string AdSense HTML code. */ function aistma_adsense_shortcode( $atts ) { // Default AdSense settings (hardcoded as requested) $adsense_client = 'ca-pub-6861474761481747'; $adsense_slot = '8915797913'; // Parse shortcode attributes $atts = shortcode_atts( array( 'client' => $adsense_client, 'slot' => $adsense_slot, 'format' => 'in-article', // Default format 'style' => 'display:block; text-align:center;', // Default style ), $atts ); // Build AdSense code $adsense_code = sprintf( // phpcs:ignore WordPress.WP.EnqueuedResources.NonEnqueuedScript -- AdSense requires inline scripts, can't be properly enqueued ' ', esc_attr( $atts['client'] ), esc_attr( $atts['style'] ), esc_attr( $atts['format'] ), esc_attr( $atts['client'] ), esc_attr( $atts['slot'] ) ); return $adsense_code; } add_shortcode( 'aistma_adsense', 'aistma_adsense_shortcode' ); /** * Enqueue style for story scroller. * * @return void */ function aistma_enqueue_style() { $css_url = AISTMA_URL . 'public/css/aistma-style.css'; wp_enqueue_style( 'aistma-story-scroller', $css_url, array(), filemtime( AISTMA_PATH . 'public/css/aistma-style.css' ) // Versioning. ); } add_action( 'wp_enqueue_scripts', 'aistma_enqueue_style', 99 );