Example #1
0
function mystique_post()
{
    global $post, $id, $comment;
    $category = get_the_category();
    $category_name = $category[0]->cat_name;
    if (!empty($category_name)) {
        $category_link = '<a href="' . get_category_link($category[0]->cat_ID) . '">' . $category_name . '</a>';
    } else {
        $category_link = "[...]";
    }
    $post_tags = get_the_tags();
    $post_settings = apply_filters('mystique_post_settings', get_option("mystique"));
    $comment_count = mystique_comment_count('comments');
    do_action('mystique_before_post');
    ?>

  <!-- post -->
  <div id="post-<?php 
    the_ID();
    ?>
" class="<?php 
    mystique_post_class('clear-block');
    ?>
">

   <?php 
    $post_thumb = mystique_post_thumb();
    if ($post_settings['post_title']) {
        $title_url = get_post_meta($post->ID, 'title_url', true);
        ?>
     <h2 class="title"><a href="<?php 
        if ($title_url) {
            echo $title_url;
        } else {
            the_permalink();
        }
        ?>
" rel="bookmark" title="<?php 
        _e('Permanent Link:', 'mystique');
        echo ' ';
        the_title_attribute();
        ?>
"><?php 
        the_title();
        ?>
</a></h2>
   <?php 
    }
    ?>

   <?php 
    if ($post_settings['post_info'] && !get_post_meta($post->ID, 'asides', true)) {
        ?>
     <div class="post-date">
       <p class="day"><?php 
        the_time(__('M jS', 'mystique'));
        ?>
</p>
     </div>

     <div class="post-info clear-block <?php 
        if ($post_thumb) {
            echo 'with-thumbs';
        }
        ?>
">
      <p class="author alignleft"><?php 
        printf(__('Posted by %1$s in %2$s', 'mystique'), '<a href="' . get_author_posts_url(get_the_author_meta('ID')) . '" title="' . sprintf(__("Posts by %s", "mystique"), attribute_escape(get_the_author())) . ' ">' . get_the_author() . '</a>', $category_link);
        ?>
      <?php 
        if (function_exists('the_views')) {
            ?>
<span class="postviews">| <?php 
            the_views();
            ?>
</span><?php 
        }
        ?>
      <?php 
        edit_post_link(__('Edit', 'mystique'), ' | ');
        ?>
      </p>
      <?php 
        if (comments_open() || $comment_count > 0) {
            ?>
      <p class="comments alignright"><a href="<?php 
            the_permalink();
            ?>
#comments" class="<?php 
            if ($comment_count < 1) {
                echo "no";
            }
            ?>
 comments"><?php 
            comments_number(__('No comments', 'mystique'), __('1 comment', 'mystique'), __('% comments', 'mystique'));
            ?>
</a></p>
      <?php 
        }
        ?>
     </div>
    <?php 
    }
    ?>

   <?php 
    if ($post_settings['post_content']) {
        ?>
     <div class="post-content clear-block">
      <?php 
        if ($post_settings['post_content_length'] == 'f') {
            the_content(__('More &gt;', 'mystique'));
        } elseif ($post_settings['post_content_length'] == 'e') {
            the_excerpt();
        } else {
            $word_count = $post_settings['post_content_length'];
            // save original post content to variable
            $content = get_the_content();
            // prevent tags strip | it's a bug in WordPress!
            $content = apply_filters('the_content', $content);
            $content = str_replace(']]>', ']]&gt;', $content);
            // throw out trimmed: content to process, read more tag, post permalink, words length
            echo mystique_trim_the_content($content, __('More &gt;', 'mystique'), get_permalink($post->ID), $word_count);
        }
        ?>
     </div>
   <?php 
    }
    ?>
   <?php 
    if (function_exists('the_ratings')) {
        the_ratings();
    }
    ?>

   <?php 
    if ($post_tags && $post_settings['post_tags']) {
        ?>
    <div class="post-tags">
    <?php 
        $tags = array();
        $i = 0;
        foreach ($post_tags as $tag) {
            $tags[$i] .= '<a href="' . get_tag_link($tag->term_id) . '" rel="tag" title="' . sprintf(__('%1$s (%2$s topics)'), $tag->name, $tag->count) . '">' . $tag->name . '</a>';
            $i++;
        }
        echo implode(', ', $tags);
        ?>
    </div>
    <?php 
    }
    ?>


  </div>
  <!-- /post -->
 <?php 
    do_action('mystique_after_post');
}
Example #2
0
  <div class="section" id="section-relatedPosts">
    <?php 
    $backup = $post;
    while ($rp_query->have_posts()) {
        $rp_query->the_post();
        ?>
         <!-- short post -->
         <div id="post-<?php 
        the_ID();
        ?>
" class="<?php 
        mystique_post_class();
        ?>
">
           <?php 
        mystique_post_thumb();
        ?>
	   	   <h3 class="title"><a href="<?php 
        the_permalink();
        ?>
" rel="bookmark" title="Permanent Link to <?php 
        the_title_attribute();
        ?>
"><?php 
        the_title();
        ?>
</a></h3>
           <p class="post-short-info"><strong><?php 
        echo mystique_timesince(get_the_time('U'));
        ?>
</strong> - <?php 
Example #3
0
function mystique_featured_post()
{
    if (mystique_featured_post_target_page()) {
        //global $valid_featured_posts;
        global $wp_query;
        $featured_posts = get_mystique_option('featured_posts');
        $found_posts = array();
        $featured_posts = explode(',', $featured_posts);
        shuffle($featured_posts);
        // randomize
        foreach ($featured_posts as $featured_post) {
            $current_post = get_post($featured_post);
            $current_post = (array) $current_post;
            if ($current_post) {
                // take it in consideration only if is a recent post
                if (strtotime($current_post['post_date_gmt']) > strtotime('-' . get_mystique_option('featured_timeframe') . ' days')) {
                    $found_posts[] = $current_post;
                }
            }
        }
        // remove posts from the main loop (on homepage)?
        // $wp_query->query_vars['post__not_in'] = $found_posts;
        $count = (int) get_mystique_option('featured_count');
        ?>

<div id="featured-content"<?php 
        if ($count > 1 && count($found_posts) > 1) {
            ?>
 class="withSlider"<?php 
        }
        ?>
>
 <?php 
        if ($found_posts) {
            // only show if the global variable is set in the function above
            ?>
 <!-- block container -->
 <div class="slide-container">
  <ul class="slides">
       <?php 
            $number = 1;
            foreach ($found_posts as $featured_post) {
                ?>
         <!-- slide (100%) -->
         <li class="slide slide-<?php 
                echo $number;
                ?>
 featured-content">
          <div class="slide-content clearfix">
            <div class="details clearfix">
             <?php 
                mystique_post_thumb('featured-thumbnail', $featured_post['ID']);
                echo '<h2><a href="' . get_permalink($featured_post['ID']) . '">' . mystique_strip_string(70, strip_tags($featured_post['post_title'])) . '</a></h2>';
                echo '<div class="summary">' . mystique_strip_string(420, strip_tags(strip_shortcodes($featured_post['post_content']))) . '</div>';
                ?>
            </div>
          <a class="readmore" href="<?php 
                echo get_permalink($featured_post['ID']);
                ?>
"><?php 
                _e("More", "mystique");
                ?>
</a>
          </div>
         </li>
         <!-- /slide -->
         <?php 
                if ($count == $number) {
                    break;
                }
                $number++;
            }
            ?>
  </ul>
 </div>
 <!-- /block container -->
 <?php 
        } else {
            if (current_user_can('switch_themes')) {
                echo '<h4>' . sprintf(__("No featured posts found older than %s days.", "mystique"), get_mystique_option('featured_timeframe')) . '</h4>';
            }
        }
        ?>
</div>

   <?php 
    }
}