示例#1
0
 /**
  * Erstellung eines Artikelteasers
  */
 function piratenkleider_post_teaser($titleup = 1, $showdatebox = 1, $showdateline = 0, $teaserlength = 200, $thumbfallback = 1, $usefloating = 0, $titlenum = 2)
 {
     global $options;
     global $post;
     $post_id = $post->ID;
     $sizeclass = '';
     $out = '';
     if ('linktipps' == get_post_type()) {
         $out = linktipp_display($post);
         return $out;
     }
     $leftbox = '';
     $sizeclass = 'p3-column withthumb';
     if ($showdatebox > 0 && $showdatebox < 5) {
         // Generate Thumb/Pic or Video first to find out which class we need
         $leftbox .= '<div class="infoimage">';
         $sizeclass = 'p3-column withthumb';
         $thumbnailcode = '';
         $firstpic = '';
         $firstvideo = '';
         if (has_post_thumbnail()) {
             $thumbnailcode = get_the_post_thumbnail($post->ID, 'teaser-thumb');
         }
         $firstpic = get_piratenkleider_firstpicture();
         $firstvideo = get_piratenkleider_firstvideo();
         $fallbackimg = '<img itemprop="image" src="' . $options['src-teaser-thumbnail_default'] . '" alt="">';
         if ($showdatebox == 1) {
             if (!isset($output)) {
                 $output = $thumbnailcode;
             }
             if (!isset($output)) {
                 $output = $firstpic;
             }
             if (!isset($output) && isset($firstvideo)) {
                 $output = $firstvideo;
                 $sizeclass = 'p3-column withvideo';
             }
             if (!isset($output)) {
                 $output = $fallbackimg;
             }
             if (isset($output) && strlen(trim($output)) < 10) {
                 $output = $fallbackimg;
             }
         } elseif ($showdatebox == 2) {
             if (!isset($output)) {
                 $output = $firstpic;
             }
             if (!isset($output)) {
                 $output = $thumbnailcode;
             }
             if (!isset($output) && isset($firstvideo)) {
                 $output = $firstvideo;
                 $sizeclass = 'p3-column withvideo';
             }
             if (!isset($output)) {
                 $output = $fallbackimg;
             }
             if (isset($output) && strlen(trim($output)) < 10) {
                 $output = $fallbackimg;
             }
         } elseif ($showdatebox == 3) {
             if (!isset($output) && isset($firstvideo)) {
                 $output = $firstvideo;
                 $sizeclass = 'p3-column withvideo';
             }
             if (!isset($output)) {
                 $output = $thumbnailcode;
             }
             if (!isset($output)) {
                 $output = $firstpic;
             }
             if (!isset($output)) {
                 $output = $fallbackimg;
             }
             if (isset($output) && strlen(trim($output)) < 10) {
                 $output = $fallbackimg;
             }
         } elseif ($showdatebox == 4) {
             if (!isset($output) && isset($firstvideo)) {
                 $output = $firstvideo;
                 $sizeclass = 'p3-column withvideo';
             }
             if (!isset($output)) {
                 $output = $firstpic;
             }
             if (!isset($output)) {
                 $output = $thumbnailcode;
             }
             if (!isset($output)) {
                 $output = $fallbackimg;
             }
             if (isset($output) && strlen(trim($output)) < 10) {
                 $output = $fallbackimg;
             }
         } else {
             $output = $fallbackimg;
         }
         $leftbox .= $output;
         $leftbox .= '</div>';
     } else {
         $sizeclass = 'p3-column';
     }
     if ($usefloating == 1) {
         $sizeclass .= " usefloating";
     }
     $out .= '<section itemscope itemtype="http://schema.org/Article" class="' . implode(' ', get_post_class($sizeclass)) . '" id="post-' . $post->ID . '" >';
     $titlenum = (int) $titlenum;
     if ($titlenum < 1 || $titlenum > 6) {
         $titlenum = 2;
     }
     $htmltitlestart = '<h' . $titlenum . '>';
     $htmltitleend = '</h' . $titlenum . '>';
     $subtitle = get_post_meta($post->ID, 'piratenkleider_subtitle', true);
     if ($titleup == 1) {
         $out .= '<header itemprop="name" class="post-title p3-cbox">';
         if ($subtitle) {
             $out .= '<h3 class="subtitle">' . $subtitle . "</h3>\n";
         }
         $out .= $htmltitlestart;
         $out .= '<a itemprop="url" href="' . get_permalink() . '" rel="bookmark">';
         $out .= get_the_title();
         $out .= '</a>' . $htmltitleend . '</header>';
         $out .= "\n";
         $out .= '<div class="p3-column">';
     }
     if ($showdatebox < 5) {
         $out .= '<div class="post-info p3-col1"><div class="p3-cbox">';
         if ($showdatebox == 0) {
             $num_comments = get_comments_number();
             if ($num_comments > 0 || $options['zeige_commentbubble_null']) {
                 $out .= '<div class="commentbubble">';
                 $link = get_comments_link();
                 $out .= '<a href="' . $link . '">' . $num_comments . '<span class="skip"> ';
                 if ($num_comments > 0) {
                     $out .= __('Comments', 'piratenkleider') . '</span></a>';
                 } else {
                     $out .= __('Comment', 'piratenkleider') . '</span></a>';
                 }
                 $out .= "</div>\n";
             }
             $out .= '<div class="cal-icon" itemprop="datePublished" content="' . get_the_date('Y-m-d') . '">';
             $out .= '<span class="day">' . get_the_time('j.') . '</span>';
             $out .= '<span class="month">' . get_the_time('m.') . '</span>';
             $out .= '<span class="year">' . get_the_time('Y') . '</span>';
             $out .= "</div>\n";
         } else {
             $out .= $leftbox;
         }
         $out .= "</div></div>\n";
         $out .= '<article class="post-entry p3-col3">';
         $out .= '<div class="p3-cbox';
         if ($usefloating == 0) {
             $out .= ' p3-clearfix';
         }
         $out .= '">';
     } else {
         $out .= '<article class="post-entry p3-cbox">';
     }
     if ($titleup == 0) {
         $out .= '<header itemprop="name" class="post-title">';
         if ($subtitle) {
             $out .= '<h3 class="subtitle">' . $subtitle . "</h3>\n";
         }
         $out .= $htmltitlestart;
         $out .= '<a href="' . get_permalink() . '" rel="bookmark">';
         $out .= get_the_title();
         $out .= "</a>" . $htmltitleend . "</header>\n";
     }
     if ($showdatebox != 0 && $showdateline == 1) {
         $out .= '<p class="pubdateinfo" itemprop="datePublished" content="' . get_the_date('Y-m-d') . '">';
         $out .= piratenkleider_post_pubdateinfo(0);
         $out .= "</p>\n";
     }
     $out .= get_piratenkleider_custom_excerpt($teaserlength, 1, 1, $options['continuelink']);
     if ($showdatebox < 5) {
         $out .= "</div>\n";
         $out .= '<div class="p3-ie-clearing">&nbsp;</div>';
     }
     $out .= "</article>\n";
     if ($titleup == 1) {
         $out .= '</div>';
     }
     $out .= "</section>\n";
     return $out;
 }
示例#2
0
function linktipps_shortcode($atts)
{
    extract(shortcode_atts(array('cat' => '', 'num' => 5), $atts));
    $num = sanitize_text_field($num);
    $cat = sanitize_text_field($cat);
    if (isset($cat) && strlen(trim($cat)) > 0) {
        $args = array('post_type' => 'linktipps', 'tax_query' => array(array('taxonomy' => 'linktipp_category', 'field' => 'slug', 'terms' => $cat)), 'posts_per_page' => $num);
    } else {
        $args = array('post_type' => 'linktipps', 'posts_per_page' => $num);
    }
    $links = new WP_Query($args);
    if ($links->have_posts()) {
        $out = '';
        while ($links->have_posts()) {
            $links->the_post();
            $out .= linktipp_display($links->post, 'shortcode');
        }
        wp_reset_postdata();
    } else {
        $out = '<section class="shortcode linktipps"><p>';
        $out .= __('No bookmarks found.', 'piratenkleider');
        $out .= "</p></section>\n";
    }
    return $out;
}
示例#3
0
if ($options['artikelstream-type'] > 0) {
    /* Zuerst Linktipps */
    if ($options['artikelstream-show-linktipps'] == 1) {
        $linktippout = '';
        $i = 0;
        $continuelinks = '';
        $numentries = $options['artikelstream-maxnum-linktipps'] + $options['artikelstream-nextnum-linktipps'];
        $z = 1;
        query_posts(array('post_type' => array('linktipps'), 'posts_per_page' => $numentries));
        global $post;
        $linktippout .= '<div class="columns">';
        while (have_posts() && $i < $numentries) {
            the_post();
            $i++;
            if ($i <= $options['artikelstream-maxnum-linktipps']) {
                $out = linktipp_display($post);
                $linktippout .= '<div class="column' . $z . '">' . $out . '</div>';
                $z++;
                if ($z > 2) {
                    $z = 1;
                    $linktippout .= '<hr class="clear">';
                }
            } elseif ($options['artikelstream-nextnum-linktipps'] > 0) {
                $link = esc_attr(get_post_meta($post->ID, 'linktipp_url', true));
                $continuelinks .= '<li><a class="extern" href="' . $link . '">' . get_the_title() . '</a></li>';
                $continuelinks .= "\n";
            }
        }
        if (isset($continuelinks) && strlen($continuelinks) > 0) {
            $linkliste = '<div class="column' . $z . '"><section class="linktipps">';
            if (isset($options['artikelstream-title-linktippcontinuelist']) && strlen($options['artikelstream-title-linktippcontinuelist']) > 1) {