Loop the index plug-in jeckpack post view - php

I'm trying to get my index of the loop in order list for viewing. I'm using Jetpack Post Views for this
Ex: the most viewed post is first and so on.
I use a custom post with namo movies , only queensize my loop is not bringing this custom post.
Could anyone help me ?
<div id="content">
<?php if( function_exists( 'stats_get_csv' ) ) :
$top_posts = stats_get_csv( 'postviews', array( 'days' => 21, 'limit' => -1 ) );
$top_ids = array();
foreach ( $top_posts as $top_post ) {
$top_ids[] = $top_post['post_id'];
}
// Check for transient, hat tip Greg Rickaby
if ( false === ( $tops = get_transient( 'popular_posts' ) ) ) :
$top_args = new WP_Query( array(
'posts_per_page' => '5',
'post__in' => $top_ids,
'posts_per_page' => 14,
'post_type' => array('movies')
)
);
$tops = new WP_Query( $top_args );
// Store transient and expire after 24 hours
set_transient( 'popular_posts', $tops, 24 * HOUR_IN_SECONDS );
endif;
while ($tops->have_posts()) : $tops->the_post(); ?>
<div class="box " id="post-<?php the_ID(); ?>">
<div class="boxim">
<?php
if ( has_post_thumbnail() ) { ?>
<img class="boximg" src="<?php bloginfo('stylesheet_directory'); ?>/timthumb.php?src=<?php get_image_url(); ?>&h=270&w=180&zc=1" alt=""/>
<?php } else { ?>
<img class="boximg" src="<?php bloginfo('template_directory'); ?>/images/dummy.png" alt="" />
<?php } ?>
<div class="scorebox">
<span class="sholder"> <span class="scorebar score-<?php $rscore=get_post_meta($post->ID, 'wtf_rscore', true); echo $rscore; ?>"> </span> </span>
</div>
</div>
<div class="boxentry">
<div class="btitle">
<h2><?php the_title(); ?></h2>
</div>
<div class="bmeta">
<span class="mgenre"><?php echo get_the_term_list( $post->ID, 'movie-genre', '', ', ', '' ); ?></span> <span class="mcom"><?php comments_popup_link('0', '1', '%'); ?></span>
</div>
<div class="clear"></div>
</div>
</div>
<?php if(++$counter % 3 == 0) : ?>
<div class="clear"></div>
<?php endif; ?>
<?php endwhile; wp_reset_postdata(); ?>
<div class="clear"></div>
<?php getpagenavi(); ?>
<?php endif; ?>
</div>

Related

Wrapping a div around the results of a word press loop but excluding the first 2

I have a loop for a custom post type. I'm bringing back a block of title, image and content for each post. I want to apply slick slider to the results to create a slick carousel, but I don;t want to include the first two results of the loop - so I'd need to create a parent div to the results but only start that div after the first two results.
I've trialed ways of querying the results on a loop count to apply a class to only the first two results, but this doesn't really achieve what I'm after.
<div class="wrapper_for_news_items">
<?php
$posts = get_posts(array(
'posts_per_page' => -1,
'post_type' => 'news',
'order' => 'DESC'
));
if( $posts ): ?>
<?php $post = $posts[0]; $c=0; ?>
<?php foreach( $posts as $post ):
setup_postdata( $post );
?>
<div class="treatment_block news_block <?php $c++; if($c == 1) { echo ' featured'; } elseif($c == 2) { echo ' featured'; } ?>">
<h2 class="block_title above"> <?php the_title( '' ); ?></h2>
<h3 class="post_date top">
<?php echo get_the_date() ?>
</h3>
<div class="post_icon" style="background-image: url('<?php
if ( has_post_thumbnail() ) { // check if the post has a Post Thumbnail assigned to it.
the_post_thumbnail_url($post_id, 'thumbnail');
}
?>');">
<button class="post__link but" rel="<?php the_ID(); ?>">READ MORE</button>
</div>
<h2 class="block_title below"> <?php the_title( '' ); ?></h2>
<h3 class="post_date bottom">
<?php echo get_the_date() ?>
</h3>
<p class="excerpt">
<?php the_excerpt( '' ); ?>
</p>
</div>
<?php endforeach; ?>
<?php wp_reset_postdata(); ?>
<?php else : ?>
No News Found!
<?php endif; ?>
<!-- end of news loop -->
</div> <!-- treatment news block wrapper -->
You could just create 2 loops.
Use the first for the featured output and the second for the carousel.
<div class="wrapper_for_news_items">
<?php
$args_with_two_posts = array(
'posts_per_page' => 2,
'post_type' => 'news',
'order' => 'DESC'
);
$query_with_two_posts = new WP_Query( $args_with_two_posts );
if( $query_with_two_posts->have_posts ) :
while ( $query_with_two_posts->have_posts ) : $query_with_two_posts->the_posts; ?>
<div class="treatment_block news_block featured">
<h2 class="block_title above">
<?php the_title( '' ); ?>
</h2>
<h3 class="post_date top">
<?php echo get_the_date() ?>
</h3>
<div class="post_icon" style="background-image: url('<?php
if ( has_post_thumbnail() ) { // check if the post has a Post Thumbnail assigned to it.
the_post_thumbnail_url($post_id, 'thumbnail');
}
?>');">
<button class="post__link but" rel="<?php the_ID(); ?>">READ MORE</button>
</div>
<h2 class="block_title below">
<?php the_title( '' ); ?>
</h2>
<h3 class="post_date bottom">
<?php echo get_the_date() ?>
</h3>
<p class="excerpt">
<?php the_excerpt( '' ); ?>
</p>
</div>
<?php endwhile; ?>
<?php wp_reset_postdata(); ?>
<?php else : ?> No News Found!
<?php endif; ?>
<!-- end of 2 post initial news loop -->
</div>
<!-- treatment news block wrapper -->
<?php
// Start your second loop containing the slickslider content
?>
<div class="wrapper_for_news_carousel_items">
<?php
$args_with_all_posts = array(
'posts_per_page' => -1,
'offset' => 2 // Offset the 2 initial posts
'post_type' => 'news',
'order' => 'DESC'
);
$query_with_two_posts = new WP_Query( $args_with_all_posts );
if( $args_with_all_posts->have_posts ) :
while ( $args_with_all_posts->have_posts ) : $args_with_all_posts->the_posts; ?>
<div class="treatment_block news_block">
<h2 class="block_title above">
<?php the_title( '' ); ?>
</h2>
<h3 class="post_date top">
<?php echo get_the_date() ?>
</h3>
<div class="post_icon" style="background-image: url('<?php
if ( has_post_thumbnail() ) { // check if the post has a Post Thumbnail assigned to it.
the_post_thumbnail_url($post_id, 'thumbnail');
}
?>');">
<button class="post__link but" rel="<?php the_ID(); ?>">READ MORE</button>
</div>
<h2 class="block_title below">
<?php the_title( '' ); ?>
</h2>
<h3 class="post_date bottom">
<?php echo get_the_date() ?>
</h3>
<p class="excerpt">
<?php the_excerpt( '' ); ?>
</p>
</div>
<?php endwhile; ?>
<?php wp_reset_postdata(); ?>
<?php else : ?> No News Found!
<?php endif; ?>
<!-- end of news loop -->
</div>
<!-- treatment news carousel items -->
Or you could count the posts in the loop and asign a wrapper before the third post and after the last post to create the carousel.
<div class="wrapper_for_news_items">
<?php
$args_with_two_posts = array(
'posts_per_page' => 2,
'post_type' => 'news',
'order' => 'DESC'
);
$query = new WP_Query( $args_with_two_posts );
$counter = 1; // Set the counter
if( $query->have_posts ) :
while ( $query->have_posts ) : $query->the_posts;
if ( $count == 3 ) { echo '<div class="slick-slider">'; };
?>
<div class="treatment_block news_block">
<h2 class="block_title above">
<?php the_title( '' ); ?>
</h2>
<h3 class="post_date top">
<?php echo get_the_date() ?>
</h3>
<div class="post_icon" style="background-image: url('<?php
if ( has_post_thumbnail() ) { // check if the post has a Post Thumbnail assigned to it.
the_post_thumbnail_url($post_id, 'thumbnail');
}
?>');">
<button class="post__link but" rel="<?php the_ID(); ?>">READ MORE</button>
</div>
<h2 class="block_title below">
<?php the_title( '' ); ?>
</h2>
<h3 class="post_date bottom">
<?php echo get_the_date() ?>
</h3>
<p class="excerpt">
<?php the_excerpt( '' ); ?>
</p>
</div>
<?php
$counter++; // Add +1 every loop
if (($query->current_post +1) == ($query->post_count)) {
echo '</div>'; // This is the last post
}
endwhile;
?>
<?php wp_reset_postdata(); ?>
<?php else : ?> No News Found!
<?php endif; ?>
<!-- end of news loop -->
</div>
<!-- treatment news block wrapper -->

WP_Query and variables in php (WordPress)

I have a set_gallery function and I pass the set_args array to her. The set_args array always changes. I'm looking for a solution for deleting posts posted and so that the loop outputs posts with new parameters. How can this be realized? Thanks...
function set_gallery($set_args = '') { ?>
<?php if ($set_args == '') {
$args = array (
'post_type' => 'gallerys',
'posts_per_page' => '-1'
);
} else {
$args = $set_args;
} ?>
<?php $gallerys_posts = new WP_Query($args);
wp_reset_query();
if( $gallerys_posts->have_posts() ) :
while ( $gallerys_posts->have_posts() ) :
$gallerys_posts->the_post(); ?>
<div class="col-lg-4 col-md-4 col-sm-6 col-xs-12 shuffle-item filtered">
<div class="portfolio-item">
<a href="<?php echo get_permalink(get_the_id());?>">
<?php if ( get_the_post_thumbnail(get_the_id()) ) { ?>
<?php echo get_the_post_thumbnail( get_the_id(), array(620, 423 )); ?>
<?php } ?>
<div class="portfolio-overlay">
<div class="caption">
<?php the_title(); ?>
<span>
<?php echo get_the_content(); ?>
</span>
</div>
</div>
</a>
</div>
</div>
<?php endwhile; endif; wp_reset_query();?>
<?php }

WordPress loop alternate rows and columns each two posts with bootstrap

I want to create a loop for wordpress that returns each two posts inside its own div and alternating columns every new row (see example)... Im not experimented in php enough to make this happen. I dont manage to get it working appropiatly. And see how to make the last div to bee 100% width if it does not have another column.
I would appreciate your support to make this happen since I tried many things and still no luck. (im using visual composer bootstrap classes, it does work but not as expected.This is the example I want to create
This is my code:
<?php
$args = array(
'posts_per_page' => '-1',
'post_type' => 'inversion',
'category_name' => '',
'order' => 'DESC',
'orderby' => 'DATE'
);
$the_query = new WP_Query( $args );?>
<?php if ( $the_query->have_posts() ) : ?>
<div class="vc_row">
<?php while ( $the_query->have_posts() ) : $the_query->the_post(); $i++; $imagen = get_the_post_thumbnail_url(get_the_ID(),'full'); ?>
<?php if(($i % 2) == 2) : ?>
<div class="vc_col-sm-6">
<div class="vc_row vc_row-fluid">
<div class="vc_col-sm-6 cont-izq">
<h3><?php the_title(); ?></h3>
</div>
<div class="vc_col-sm-6 cont-der" >
<a class="click-info">Más Información</a>
<div class="img-dentro kenburns-top" style="background:url(<?php echo $imagen; ?>)no-repeat; background-size:cover;">
</div>
</div>
</div>
</div>
<?php else : ?>
<div class="vc_col-sm-6">
<div class="vc_row vc_row-fluid">
<div class="vc_col-sm-6 cont-der" >
<a class="click-info">Más Información</a>
<div class="img-dentro kenburns-top" style="background:url(<?php echo $imagen; ?>)no-repeat; background-size:cover;">
</div>
</div>
<div class="vc_col-sm-6 cont-izq">
<h3><?php the_title(); ?></h3>
</div>
</div>
</div>
<?php endif; endwhile; ?>
</div>
<?php endif; ?>
<?php wp_reset_query(); ?>
[EDIT]Try this:
<?php
$args = array(
'posts_per_page' => '-1',
'post_type' => 'inversion',
'category_name' => '',
'order' => 'DESC',
'orderby' => 'date',
);
$the_query = new WP_Query( $args );
?>
<?php if ( $the_query->have_posts() ) : ?>
<div class="vc_row">
<?php
$float_class = '';
while ( $the_query->have_posts() ) :
$the_query->the_post();
if ( $the_query->current_post &&
$the_query->current_post % 2 === 0 ) {
$float_class = $float_class ? '' : 'vc_pull-right';
}
$imagen = get_the_post_thumbnail_url( get_the_ID(), 'full' );
?>
<div class="vc_col-sm-6">
<div class="vc_row vc_row-fluid">
<div class="vc_col-sm-6 cont-der <?php echo $float_class; ?>">
<a class="click-info">Más Información</a>
<div class="img-dentro kenburns-top" style="background:url('<?php echo esc_url( $imagen ); ?>') no-repeat; background-size:cover;">
</div>
</div>
<div class="vc_col-sm-6 cont-izq">
<h3><?php the_title(); ?></h3>
</div>
</div>
</div>
<?php endwhile; // end have_posts() loop ?>
</div><!-- .vc_row -->
<?php endif; // end have_posts() check ?>
<?php wp_reset_query(); ?>

the_content(); not showing in images.php

I am having problem getting the_content(); on image.php or attachment.php, the_content(); it's showing in single.php but no in imaage.php, I tried to edit the code but I got nothing,
<div class="content section-inner">
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<div class="posts">
<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<div class="content-inner">
<div class="featured-media">
<?php $imageArray = wp_get_attachment_image_src($post->ID, 'full', false); ?>
<a href="<?php echo esc_url( $imageArray[0] ); ?>" title="<?php the_title_attribute(); ?>" rel="attachment">
<?php echo wp_get_attachment_image( $post->ID, 'post-image' ); ?></a>
</div> <!-- /featured-media -->
<div class="post-header">
<h2 class="post-title"><?php echo basename(get_attached_file( $post->ID )); ?></h2>
<div class="post-meta">
<span><?php _e('Uploaded', 'lingonberry'); echo ' '; the_time(get_option('date_format')); ?></span>
<span class="date-sep">/</span>
<span><?php _e('Width:', 'lingonberry'); echo ' ' . $imageArray[1] . ' px'; // 1 is the width ?></span>
<span class="date-sep">/</span>
<span><?php _e('Height:', 'lingonberry'); echo ' ' . $imageArray[2] . ' px'; // 2 is the height ?></span>
</div>
</div> <!-- /post-header -->
<?php if ( ! empty( $post->post_excerpt ) ) : ?>
<div class="post-content">
<?php the_excerpt(); ?>
</div> <!-- /post-content -->
<?php endif; ?>
</div> <!-- /content-inner -->
<div class="post-nav">
<?php
/**
* Grab the IDs of all the image attachments in a gallery so we can get the URL of the next adjacent image in a gallery,
* or the first image (if we're looking at the last image in a gallery), or, in a gallery of one, just the link to that image file
*/
$attachments = array_values( get_children( array( 'post_parent' => $post->post_parent, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => 'ASC', 'orderby' => 'menu_order ID' ) ) );
foreach ( $attachments as $k => $attachment ) :
if ( $attachment->ID == $post->ID )
break;
endforeach;
$l = $k - 1;
$k++;
if ( isset( $attachments[ $k ] ) ) :
// get the URL of the next image attachment
$next_attachment_url = get_attachment_link( $attachments[ $k ]->ID );
$prev_attachment_url = get_attachment_link( $attachments[ $l ]->ID );
else :
// or get the URL of the first image attachment
$next_attachment_url = get_attachment_link( $attachments[ 0 ]->ID );
endif;
?>
<?php _e('« Previous<span> attachment</span>', 'lingonberry'); ?>
<?php _e('Next<span> attachment</span> »', 'lingonberry'); ?>
<div class="clear"></div>
</div> <!-- /post-nav -->
<?php comments_template( '', true ); ?>
<?php endwhile; else: ?>
<p><?php _e("We couldn't find any posts that matched your query. Please try again.", "lingonberry"); ?></p>
<?php endif; ?>
</div> <!-- /post -->
</div> <!-- /posts -->
I need help on this
Your code is bit of a mystery but if it looks like this
<?php if ( ! empty( $post->post_excerpt ) ) : ?>
<div class="post-content">
<?php the_excerpt(); ?>
<?php the_content(); ?>
</div> <!-- /post-content -->
<?php endif; ?>
the commands the_excerpt() and the_content() will only execute when there is an excerpt present. The if-statement says "if excerpt is not empty then execute the following code.
Try this:
<div class="post-content">
<?php if ( ! empty( $post->post_excerpt ) ) : ?>
<?php the_excerpt(); ?>
<?php endif; ?>
<?php the_content(); ?>
</div> <!-- /post-content -->
There is a shorter way of writing this but this way it shows the change better.

Wordpress - Permalinks settings stop page-templates from working

I'm about to finish a wordpress-site with a custom theme and several custom-post-types. Now i wanted to change the permalink settings to %post-name%, to make the url's nicer and this is where the problems start.
I have 3 custom-post-types next to the default post-format: events, galleries, shop. Now when I load the page "events (using the template-events.php, what does a wp_query to get all the events), I get all posts. It basically ignores the defined template and loads the one defined for the posts-page, same happens for the shop-page.
The strange thing is that the gallery page (loading the same kind of template file to do the wp_query) works fine.
When I change back to the default permalink-setting everything works fine...
Thanks for any hint!
here my template-events.php
<?php
/*
Template Name: Events
*/
?>
<?php get_header(); ?>
<?php
//Fix homepage pagination
if ( get_query_var('paged') ) {
$paged = get_query_var('paged');
} else if ( get_query_var('page') ) {
$paged = get_query_var('page');
} else {
$paged = 1;
}
$now = strtotime("now");
$args = array(
'post_type' => 'events',
'posts_per_page' => 40,
'post_status' => 'publish',
'meta_key' => '_cmb_date_timestamp',
'orderby' => 'meta_value',
'order' => 'ASC',
'paged' => $paged,
'meta_query' => array(
array(
'key' => '_cmb_date_timestamp',
'value' => $now,
'type' => 'NUMERIC',
'compare' => '>=' )
)
);
// Create a new filtering function that will add our where clause to the query
function filter_where( $where = '' ) {
// posts in the last 30 days
$where .= " AND _cmb_date_timestamp < '" . date('Y-m-d') . "'";
return $where;
}
//add_filter( 'posts_where', 'filter_where' );
$events_query = new WP_Query($args);
if( $events_query->have_posts() ) :
$derLudwig = get_theme_mod( 'eventsHeading', '');
$url = esc_url( get_theme_mod( 'events_image' ) );
echo '<div class="overview-header" style="background-image: url('.$url.');"></div>';
echo '<h2 class="overview">der Ludwig '.$derLudwig.'</h2>';
?>
<div id="filters">
<div id="filterButtons">
<a id="filterOpen" class="filterB" href="#"><img src="<?php echo get_bloginfo("template_url"); ?>/images/sub-navi2.png"/></a>
<a id="filterClose" class="filterB" href="#"><img src="<?php echo get_bloginfo("template_url"); ?>/images/filter-close.png"/></a>
</div>
<?php
/* FILTERS */
$args = array(
'type' => 'events',
'taxonomy' => 'event_category',
'orderby' => 'name',
'order' => 'ASC'
);
$categories = get_categories($args);
echo '<div id="categories">';
echo '<h5>Kategorien: </h5>';
echo '<ul>';
foreach ($categories as $category) {
echo '<li>' . $category->name . '</li>';
}
echo '</ul>';
echo '</div>';
?>
Clear
</div>
<!--BEGIN #content -->
<div id="content" class="clearfix">
<?php
echo '<img class="loader" src="'.get_bloginfo('template_url').'/images/loader.gif"/>';
echo '<div id="primary" class="hfeed event-overview">';
while( $events_query->have_posts() ) : $events_query->the_post();
// infos
$time = get_post_meta($post->ID, '_cmb_time', true);
$cdateStamp = get_post_meta($post->ID, '_cmb_date_timestamp');
$monthName = date_i18n('F', $cdateStamp[0]);
$weekdayNumber = date_i18n('j', $cdateStamp[0]);
$weekday = date_i18n('D', $cdateStamp[0]);
$locations = get_the_terms( $post->ID, 'locations' );
$tickets = get_post_meta($post->ID, '_ludwig_events_tickets', true);
$featured = get_post_meta($post->ID, '_ludwig_events_display_featured', true);
$reservation = get_post_meta($post->ID, '_ludwig_events_display_reservation', true);
// grab everything else
$custom_bg = get_post_meta($post->ID, '_zilla_portfolio_display_background', true);
$portfolio_caption = get_post_meta($post->ID, '_zilla_portfolio_caption', true);
?>
<?php
if(!isset($currentMonth) || $currentMonth != $monthName){
?>
<h2 class="<?php echo lcfirst($monthName); ?>"><?php echo $monthName; ?></h2>
<?php
}
$currentMonth = $monthName;
?>
<!--BEGIN .hentry-->
<div id="post-<?php the_ID(); ?>" class="event-small <?php echo lcfirst($monthName); ?>">
<!--BEGIN .entry-content -->
<div class="entry-content">
<div class="eTop">
<span class="dateDay"><?echo $weekdayNumber; ?></span>
<span class="dateMonth"><? _e($monthName, 'ludwig-events'); ?></span>
<span class="dateWeekDay"><? _e($weekday, 'ludwig-events'); ?></span>
</div>
<?php the_post_thumbnail('event-small'); ?>
<div class="eBottom">
<?php the_title('<h3>', '</h3>'); ?>
<span class="eventWo">
<?php
if ( $locations && !is_wp_error( $locations ) ) {
foreach ( $locations as $location ) {
echo $location->name;
}
}
?>
, <?php echo $time; ?>Uhr</span>
<div class="event-buttons">
<div class="inner">
<div class="centerContainer">
<h4>Tickets</h4>
<?php ticketsLink($tickets); ?>
<?php reservationLink($reservation); ?>
</div>
</div>
</div>
</div>
<!--END .entry-content -->
</div>
</div>
<?php endwhile; ?>
<!--END #primary .hfeed-->
</div>
<?php else: ?>
<div id="content" class="nocontent">
<!--BEGIN #post-0-->
<div id="post-0" <?php post_class(); ?>>
<h2 class="entry-title"><?php _e('Keine Events gefunden', 'ludwig') ?></h2>
<!--BEGIN .entry-content-->
<div class="entry-content">
<p><?php _e("Hoppala, das sollte eigentlich nicht passieren", "ludwig") ?></p>
<!--END .entry-content-->
</div>
<!--END #post-0-->
</div>
</div>
<?php endif; ?>
<?php remove_filter( 'posts_where', 'filter_where' ); ?>
<?php get_footer(); ?>
here the working template-gallery.php
<?php
/*
Template Name: Fotos
*/
?>
<?php get_header(); ?>
<?php
//Fix homepage pagination
if ( get_query_var('paged') ) {
$paged = get_query_var('paged');
} else if ( get_query_var('page') ) {
$paged = get_query_var('page');
} else {
$paged = 1;
}
// CHECK THAT THIS ONE ISTN DOWN
/*
$args = array(
'post_type' => 'gallery',
'posts_per_page' => 1,
'post_status' => 'publish',
'orderby' => 'modified',
'order' => 'ASC',
'tax_query' => array(
array(
'taxonomy' => 'gallery_category',
'field' => 'id',
'terms' => array( $term_id ),
'operator' => 'IN'
)
),
'paged' => $paged
);
$sina_query = new WP_Query($args);
$sinaString = '';
if( $posts_query->have_posts() ) :
while( $posts_query->have_posts() ) : $posts_query->the_post();
?>
<?php endwhile; ?>
<?php endif; ?>
*/
$args = array(
'post_type' => 'gallery',
'orderby' => 'modified',
'order' => 'DESC',
'posts_per_page' => 10,
'paged' => $paged
);
$posts_query = new WP_Query($args);
if( $posts_query->have_posts() ) :
$derLudwig = get_theme_mod( 'fotosHeading', '');
$url = esc_url( get_theme_mod( 'fotos_image' ) );
echo '<div class="overview-header" style="background-image: url('.$url.');"></div>';
echo '<h2 class="overview">der Ludwig '.$derLudwig.'</h2>';
?>
<div id="filters">
<div id="filterButtons">
<a id="filterOpen" class="filterB" href="#"><img src="<?php echo get_bloginfo("template_url"); ?>/images/sub-navi2.png"/></a>
<a id="filterClose" class="filterB" href="#"><img src="<?php echo get_bloginfo("template_url"); ?>/images/filter-close.png"/></a>
</div>
<?php
/* FILTERS */
$args = array(
'type' => 'events',
'taxonomy' => 'gallery_category',
'orderby' => 'name',
'order' => 'ASC'
);
$categories = get_categories($args);
echo '<div id="categories">';
echo '<h5>Kategorien: </h5>';
echo '<ul>';
foreach ($categories as $category) {
echo '<li>' . $category->name . '</li>';
}
echo '</ul>';
echo '</div>';
?>
Clear
</div>
<!--BEGIN #content -->
<div id="content" class="clearfix">
<?php
echo '<img class="loader" src="'.get_bloginfo('template_url').'/images/loader.gif"/>';
echo '<div id="primary" class="hfeed gallery-overview">';
$counter = 0;
while( $posts_query->have_posts() ) : $posts_query->the_post();
$fotograf = get_post_meta($post->ID, '_ludwig_gallery_fotograf', true);
?>
<?php
if ($counter == 1) {
?>
<div id="post-<?php the_ID(); ?>" class="gallery-grid post-<?php echo $counter++; ?>">
<!--BEGIN .entry-content -->
<div class="entry-content">
<a href="<?php echo get_permalink(); ?>">
<div class="overlayContainer">
<div class="overlay">
<div class="content">
<div class="inner">
<?php
/*
$terms = get_the_terms( $post->ID, 'gallery_category');
if ( $terms && ! is_wp_error( $terms ) ) :
$draught_links = array();
foreach ( $terms as $term ) {
$draught_links[] = $term->name;
}
$on_draught = join( ", ", $draught_links );
*/
?>
<p class="galleryCategories">
<span><?php //echo $on_draught; ?></span>
</p>
<?php //endif; ?>
<h3><?php the_title(); ?></h3>
<p class="fotograf">von<br><span><?php echo $fotograf; ?></span></p>
</div>
</div>
</div>
</div>
<?php the_post_thumbnail('gallery-mid'); ?></a>
</div>
</div>
<?php echo $counter++; ?>
<?php
} else {
?>
<div id="post-<?php the_ID(); ?>" class="gallery-grid post-<?php echo $counter++; ?>">
<!--BEGIN .entry-content -->
<div class="entry-content">
<a href="<?php echo get_permalink(); ?>">
<div class="overlayContainer">
<div class="overlay">
<div class="content">
<div class="inner">
<?php
/*
$terms = get_the_terms( $post->ID, 'gallery_category');
if ( $terms && ! is_wp_error( $terms ) ) :
$draught_links = array();
foreach ( $terms as $term ) {
$draught_links[] = $term->name;
}
$on_draught = join( ", ", $draught_links );
*/
?>
<p class="galleryCategories">
<span><?php //echo $on_draught; ?></span>
</p>
<?php //endif; ?>
<h3><?php the_title(); ?></h3>
<p class="fotograf">von<br><span><?php echo $fotograf; ?></span></p>
</div>
</div>
</div>
</div>
<?php the_post_thumbnail('gallery-mid'); ?></a>
</div>
</div>
<?php } ?>
<?php endwhile; ?>
<!--END .hfeed -->
</div>
<a class="archivlink" href="#">⌸ Archiv</a>
<div class="navigation">
<div class="next-posts"><?php next_posts_link('« Older Entries', $posts_query->max_num_pages) ?></div>
<div class="prev-posts"><?php previous_posts_link('Newer Entries »', $posts_query->max_num_pages) ?></div>
</div>
<?php else: ?>
<div id="content" class="nocontent">
<!--BEGIN #post-0-->
<div id="post-0" <?php post_class(); ?>>
<h2 class="entry-title"><?php _e('Keine Fotos gefunden', 'ludwig') ?></h2>
<!--BEGIN .entry-content-->
<div class="entry-content">
<p><?php _e("Hoppala, das sollte eigentlich nicht passieren", "ludwig") ?></p>
<!--END .entry-content-->
</div>
<!--END #post-0-->
</div>
</div>
<?php endif; ?>
<?php get_footer(); ?>
Hint from me (Since you do not put a code):
Nothing wrong with the permalink. It should be work. I believe what cause this is your code. Please, double check your code and re-install your WordPress, and try again.

Categories