Пример #1
0
/**
 * NOTE: functions specific to this theme should be defined in
 * functions/theme.php instead of this file.  Note the load order of files
 * listed above.
 **/
function get_call_to_action()
{
    $args = array('post_type' => 'call_to_action');
    $posts = get_posts($args);
    $random = rand(0, $posts . length - 1);
    $post = $posts[$random];
    return CallToAction::toHTML($post);
}
Пример #2
0
 public static function callback($attr, $content = '')
 {
     $attr = shortcode_atts(array('cta_id' => null), $attr);
     ob_start();
     if ($attr['cta_id']) {
         $post = get_post($attr['cta_id']);
         echo CallToAction::toHTML($post);
     }
     return ob_get_clean();
 }