/
home
/
radhikag
/
public_html
/
wp-content
/
themes
/
flatsome-child
/
Upload File
HOME
<?php // Add custom Theme Functions here // Load the theme stylesheets function theme_styles() { // Load all of the styles that need to appear on all pages wp_enqueue_style( 'webfonts', get_stylesheet_directory_uri() . '/MyFontsWebfontsKit.css' ); } add_action('wp_enqueue_scripts', 'theme_styles'); // news shortcode function - [home_news] add_shortcode( 'home_news', 'get_news_home' ); function get_news_home(){ $args = array( 'post_type' => 'news', 'posts_per_page' => 3, 'post_status' => 'publish' ); $string = '<div id="custom-post-type-recent-posts-3" class="widget widget_recent_entries"> <h2 class="widgettitle">News</h2> '; $query = new WP_Query( $args ); $count = 01; if( $query->have_posts() ){ $string .= '<ul>'; while( $query->have_posts() ){ $query->the_post(); $string .= '<li>'; //. '<div class=news-number>0' . $count++ . '</div>'; $string .= '<h3>' . get_the_title(). '</h3>'; $string .= '<div class=news-date>' . get_the_date('F j, Y') . '</div>'; $string .= '<div class=name-hm-link><a href="' . get_permalink(). '">Learn More</a></div>'. '</li>'; } $string .= '</ul></div>'; } wp_reset_postdata(); return $string; } ?>