• Hi all,

    I was altering the code of the plugin Quicksand jQuery Post Filter to match my specific requirements. After finally getting the code to work I noticed that the sidebar had disappeared. Restoring to the original code makes the sidebar reappear, so it’s my code that’s causing the problem. However, I can’t find out where in my code the error lies. Is there a quick way to check where the fault exactly lies? I have posted the only code I touched below:

    public function render() {
    ?>
            <div class="options-container">
    			<?php
    			$categories = get_categories();
    			?>
    			<ul id="filterOptions">
    				<li><a href="#" class="all">All</a></li>
    				<?php
    				foreach ($categories as $category) {
    					echo '<li><a href="#" class="' . $category->cat_ID . '">' . $category->name . "</a></li>";
    				};
    				?>
    			</ul>
    		</div>
    
    		<?php
    		// style options
    			$imageheight = get_option('quicksandheight');
    			$imagewidth = get_option('quicksandwidth');
    			$itemheight = get_option('itemheight');
    			$itemwidth = get_option('itemwidth');
    			echo '<style>';
    			if (!empty($imageheight)) {
    				echo '.item img { height:' . $imageheight . 'px;}';
    			}
    			if (!empty($imagewidth)) {
    				echo '.item img { width: ' . $imagewidth . 'px}';
    			}
    			if (!empty($itemheight)) {
    				echo 'ul.ourHolder li.item { height:' . $itemheight . 'px;}';
    			}
    			if (!empty($itemwidth)) {
    				echo 'ul.ourHolder li.item { width: ' . $itemwidth . 'px}';
    			}
    			echo '</style>';
    		?>
    		<ul class="ourHolder">
    			<?php
    			$args = array(
    				'posts_per_page' => '10',
    				'category__in' => $categories,
    				);
    			$posts = get_posts( );
    			foreach ($posts as $post) {
    				$permalink = esc_url(get_permalink($post->ID));
    				$content = apply_filters('the_content', $post->post_content);
    			?>
    				<li id="item" class="item" data-id="id-<?php echo $post->ID ?>" data-type="<?php echo wp_get_post_categories($post->ID)[0]; ?>">
    					<div class='quicksand-thumb'>
    						<a href="<?php echo $permalink; ?>">
    							<?php echo get_the_post_thumbnail( $post->ID, 'thumbnail' ); ?>
    						</a>
    					</div>
    					<div class='quicksand-content'>
    						<div class='quicksand-title'>
    							<a href="<?php echo $permalink; ?>">
    								<?php echo $post->post_title; ?>
    							</a>
    						</div>
    						<div class='quicksand-excerpt'>
    							<?php
    							echo substr($content, 0, 400) . '<a href="' . $permalink . '">[...]</a>';
    							?>
    						</div>
    					</div>
    				</li>
    				<?php
    			};
    			foreach ($posts as $post) {
    			?>
    				<li id="item" class="item" data-id="id-<?php echo $post->ID ?>" data-type="<?php foreach ($categories as $c) { echo $c . ' ';}?>" >
    					<div class="quicksand-thumb">
    						<a href="<?php echo get_permalink($post->ID); ?>">
    							<?php
    								echo get_the_post_thumbnail($post->ID);
    							?>
    						</a>
    					</div>
    					<div class="quicksand-title">
    						<a href="<?php echo get_permalink($post->ID); ?>">
    							<?php
    								echo get_the_title($post->ID);
    							?>
    						</a>
    					</div>
    					<div class="quicksand-excerpt">
    						<?php
    						$content = get_post($post->ID)->post_content;
    						$more - strpos($content, "<!--more-->");
    						if($more) {
    							$content = substr($content, 0, $more);
    						}
    						echo $content;
    						?>
    					</div>
    				</li>
    
    			<?php
    			}; ?>
    		</ul>
    			<?php
    	}
  • The topic ‘[Plugin: Quicksand jQuery Post Filter]Sidebar missing’ is closed to new replies.