Пример #1
0
/**
 * Display recent posts with shortcode.
 *
 * @since  0.9.4
 */
function rpwe_shortcode($atts, $content)
{
    if (isset($atts['cssid'])) {
        $atts['cssID'] = $atts['cssid'];
        unset($atts['cssid']);
    }
    $args = shortcode_atts(rpwe_get_default_args(), $atts);
    return rpwe_get_recent_posts($args);
}
 /**
  * Outputs the widget based on the arguments input through the widget controls.
  *
  * @since 0.1
  */
 function widget($args, $instance)
 {
     extract($args);
     // Output the theme's $before_widget wrapper.
     echo $before_widget;
     // If both title and title url is not empty, display it.
     if (!empty($instance['title_url']) && !empty($instance['title'])) {
         echo $before_title . '<a href="' . esc_url($instance['title_url']) . '" title="' . esc_attr($instance['title']) . '">' . apply_filters('widget_title', $instance['title'], $instance, $this->id_base) . '</a>' . $after_title;
         // If the title not empty, display it.
     } elseif (!empty($instance['title'])) {
         echo $before_title . apply_filters('widget_title', $instance['title'], $instance, $this->id_base) . $after_title;
     }
     // Get the recent posts query.
     echo rpwe_get_recent_posts($instance);
     // Close the theme's widget wrapper.
     echo $after_widget;
 }
/**
 * Outputs the recent posts.
 *
 * @since  0.9.4
 */
function rpwe_recent_posts($args = array())
{
    echo rpwe_get_recent_posts($args);
}
/**
 * Display recent posts with shortcode.
 *
 * @since  0.9.4
 */
function rpwe_shortcode($atts, $content)
{
    $args = shortcode_atts(rpwe_get_default_args(), $atts);
    return rpwe_get_recent_posts($args);
}