Example #1
0
function container()
{
    $postCat = getPostCat();
    if ($postCat == 'video' or wp_is_mobile()) {
        echo '';
    } else {
        echo 'container';
    }
}
Example #2
0
 * The Template for displaying all single posts.
 *
 * @package dazzling
 */
get_header();
?>
	<div id="primary" class="content-area col-sm-12">
		<main id="main" class="site-main" role="main">

		<?php 
while (have_posts()) {
    the_post();
    ?>
			
			<?php 
    $postCat = getPostCat();
    if ($postCat == 'artikel') {
        get_template_part('template/content', 'single');
    } elseif ($postCat == 'video') {
        get_template_part('template/content', 'single-video');
    }
    ?>
	
			<?php 
    //dazzling_post_nav();
    ?>
			
			<!-- comment out user comment -->
			<?php 
    // If comments are open or we have at least one comment, load up the comment template
    //if ( comments_open() || '0' != get_comments_number() ) :
    $cat_transient = str_replace('"', "", $cat_transient);
    $cat_transient = str_replace(' ', '_', $cat_transient);
    $cat_transient = str_replace(' &amp;', '_', $cat_transient);
    $cat_transient = str_replace(' &', '_', $cat_transient);
    $cats = explode(',', $cat_transient);
} else {
    $cats = array('all_posts');
}
// Loop through all categories to create a combined response
$combined_posts = array();
foreach ($cats as $cat) {
    $transient = 'json_posts_' . $cat;
    unset($category_posts);
    $category_posts = get_transient($transient);
    if ($category_posts === false) {
        $category_posts = getPostCat($_GET, $transient);
        $combined_posts = array_merge($category_posts, $combined_posts);
    } else {
        $category_posts = json_decode($category_posts);
        $combined_posts = array_merge($category_posts, $combined_posts);
    }
}
// Sort by date, dedupe, and encode as json
if (is_array($combined_posts)) {
    usort($combined_posts, create_function('$a,$b', 'return strcmp($b->date, $a->date);'));
    $combined_posts = dedupe($combined_posts);
    $combined_posts = json_encode($combined_posts);
    $combined_posts = str_replace("&quot;", "'", $combined_posts);
    echo $combined_posts;
} else {
    echo json_encode($combined_posts);