on my site, i have 4 "Program" names that link to the same page.
however instead, i want each program to link to a SPECIFIC POST.
BUT, in my php code, the names are and link are all controlled by one thing...this:
<h3 class="sub-title"> <?php the_title(); ?></h3>
if I change that href="http://questtkd.com/programs/" to href="?php the_post(); ?" will it break my site? or will that do the trick?
how do I change that href so that each sub-title will go to a specific post?
here is the code:
<?php
/**
* Practice Section.
*
* #package Lawyer_Landing_Page
*/
$section_title = get_theme_mod( 'pratice_section_page' );
$post_one = get_theme_mod( 'practice_post_one' );
$post_two = get_theme_mod( 'practice_post_two' );
$post_three = get_theme_mod( 'practice_post_three' );
$post_four = get_theme_mod( 'practice_post_four' );
$posts = array( $post_one, $post_two, $post_three, $post_four );
$posts = array_diff( array_unique( $posts ), array('') );
if( $section_title || $posts ){
?>
<section class="practice-area">
<div class="container">
<?php
lawyer_landing_page_get_section_header( $section_title );
$qry = new WP_Query( array(
'post_type' => array( 'post', 'page' ),
'posts_per_page' => -1,
'post__in' => $posts,
'orderby' => 'post__in',
'ignore_sticky_posts' => true
) );
if( $posts && $qry->have_posts() ){ ?>
<div class="row">
<?php
while( $qry->have_posts() ){
$qry->the_post(); ?>
<div class="col">
<div class="box">
<?php if( has_post_thumbnail() ){ ?>
<div class="icon-holder">
<?php the_post_thumbnail( 'lawyer-landing-page-practice' ); ?>
</div>
<?php } ?>
<div class="text-holder">
<h3 class="sub-title"> <?php the_title(); ?></h3>
<?php
the_excerpt();
?>
</div>
</div>
</div>
<?php
}
wp_reset_postdata(); ?>
</div>
<?php
}
?>
</div>
Related
I created a custom post type called "library", with its "documentation" taxonomy; The problem occurs in the pagination of the taxonomy template (taxonomy-documentation.php).
I have determined a number of "18" posts per page, for the number of posts there should be "7" pages, but I list "16" pages, the pages from "8" to "16" are empty.
The url of archive for the taxonomy is: Documentation Archive
The template loop is as follows:
<?php
$term = $wp_query->queried_object;
$getterm = $term->slug; // get current slug (E.g. winter2015)
$args = (array(
'post_type' => 'library',
'showposts' => 18,
'paged'=>$paged,
'tax_query' => array(
array(
'taxonomy' => 'documentation',
'field' => 'slug',
'terms' => $getterm
),
),
) );
$query = new wp_query( $args );
if ( $query -> have_posts() ) : while ( $query -> have_posts() ) : $query -> the_post(); ?>
<?php setPostViews(get_the_ID()); ?>
<div class="col-md-2">
<?php if ( get_post_meta( get_the_ID(), 'download_image', true ) ) : ?>
<a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php get_the_title(); ?>">
<?php
$postID = $post->ID;
$imageURI = get_post_meta($postID, 'download_image', true);
$attachmentID = pn_get_attachment_id_from_url ($imageURI);
$imagearray = wp_get_attachment_image_src( $attachmentID, 'full');
$imageURI = $imagearray[0];
$thumbarray = wp_get_attachment_image_src( $attachmentID, 'library-thumbnail');
$thumb_imageURI = $thumbarray[0];
echo "<img class='document-thumbnail' src='". $thumb_imageURI . "' alt='". get_the_title() ."' />";
?>
</a>
<?php endif; ?>
<a class="document-title" href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php echo mb_strimwidth(get_the_title(), 0, 40, '...'); ?></a><br />
<span><?php echo __('Published by', 'cyberdocentes'); ?> <a class="author-link" href="<?php echo get_author_posts_url( get_the_author_meta( 'ID' ), get_the_author_meta( 'user_nicename' ) ); ?>"><?php the_author(); ?></a></span>
</div>
<?php endwhile; rewind_posts(); ?>
<div class="clear"></div>
<div id="pagination">
<?php include(TEMPLATEPATH . '/pagenavi.php'); if (function_exists('wp_pagenavi')) { wp_pagenavi(); } else { ?>
<div class="navigation">
<div class="alignleft">
<?php next_posts_link(__('Next posts','cyberdocentes')); ?>
</div>
<div class="alignright">
<?php previous_posts_link(__('Previous posts','cyberdocentes')); ?>
</div>
</div>
<?php } ?>
</div>
<div class="clear"></div>
<?php else : ?>
<?php endif; ?>
<?php flush(); ?>
Solved code:
<div class="documents-list">
<?php
$term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'documentation' ) );
global $wp_query;
query_posts( array_merge( $wp_query->query, array( 'posts_per_page' => 18 ) ) );
if (have_posts()) : while ( have_posts() ) : the_post(); ?>
//CODE OF THE ARTICLES HERE
<?php endwhile; rewind_posts(); ?>
<?php endif; ?>
<div class="clear"></div>
<div id="pagination">
<?php include(TEMPLATEPATH . '/pagenavi.php'); if (function_exists('wp_pagenavi')) { wp_pagenavi(); } else { ?>
<div class="navigation">
<div class="alignleft">
<?php next_posts_link(__('Next posts','cyberdocentes')); ?>
</div>
<div class="alignright">
<?php previous_posts_link(__('Previous posts','cyberdocentes')); ?>
</div>
</div>
<?php } ?>
</div>
<div class="clear"></div>
<?php flush(); ?>
</div>
I'm building a custom e-commerce website using woocommerce and I'm having some trouble fixing the "add to cart button". Whenever I add the multiple amounts in the input box/quantity box it only increments or adds one item to the cart. This only happens when I create a custom loop.
On the shop and single-product page, it works fine. If I add 10 items and press the add to cart button. It exactly adds 10 items to cart.
Here is the template I have been working.
<?php
/*
* Template Name: Home
*/
get_header(); ?>
<section class="full-width home-template">
<div class="full-width shop-section">
<div class="container">
<?php
$args = array(
'post_type' => 'product',
'meta_query' => array(
array(
'key' => '_stock_status',
'value' => 'instock'
)
)
);
$crate_products = new WP_Query ( $args );
if ( $crate_products->have_posts() ) : while ( $crate_products->have_posts() ) :
$crate_products->the_post();
?>
<div id="post-<?php the_ID() ?>" class="three columns product-post">
<?php // wc_get_template_part('content', 'product'); ?>
<figure class="featured-image">
<?php
//Display Product Thumbnail
$product_thumbnail = woocommerce_get_product_thumbnail();
?>
<a href="<?php the_permalink()?>" ><?php echo $product_thumbnail ?></a>
</figure>
<h2 class="product-price"><?php wc_get_template( 'single-product/price.php' ); ?></h2>
<span class="product-name"><?php the_title(); ?></span>
<?php // woocommerce_quantity_input(); ?>
<div class="add-to-cart-btn">
<?php woocommerce_template_loop_add_to_cart( $crate_products->post, $product ); ?>
<?php // do_action( 'woocommerce_after_shop_loop_item' ); ?>
</div>
</div>
<?php wp_reset_postdata(); ?>
<?php endwhile; else: ?>
<?php endif; ?>
<?php wp_reset_query(); ?>
</div>
</div>
</section>
<?php get_footer(); ?>
What's confusing also is that the AJAX functionality works on the upsells template(up-sells.php) which is a template of woocommerce and it works fine.
<?php
/**
* Single Product Up-Sells
*
* This template can be overridden by copying it to yourtheme/woocommerce/single-product/up-sells.php.
*
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
global $product, $woocommerce_loop;
$upsells = $product->get_upsells();
if ( sizeof( $upsells ) === 0 ) {
return;
}
$meta_query = WC()->query->get_meta_query();
$args = array(
'post_type' => 'product',
'ignore_sticky_posts' => 1,
'no_found_rows' => 1,
'posts_per_page' => $posts_per_page,
'orderby' => $orderby,
'post__in' => $upsells,
'post__not_in' => array( $product->id ),
'meta_query' => $meta_query
);
$products = new WP_Query( $args );
$woocommerce_loop['columns'] = $columns;
if ( $products->have_posts() ) : ?>
<div class="upsells products">
<div class="twelve columns">
<h2><?php // _e( 'You may also like…', 'woocommerce' ) ?></h2>
</div>
<?php woocommerce_product_loop_start(); ?>
<?php while ( $products->have_posts() ) : $products->the_post(); ?>
<div id="post-<?php the_ID() ?>" class="three columns product-post">
<?php wc_get_template_part('content', 'product'); ?>
</div>
<?php endwhile; // end of the loop. ?>
<?php woocommerce_product_loop_end(); ?>
</div>
<?php endif;
wp_reset_postdata();
I have already tried applying the solutions from this developer
https://gist.github.com/claudiosmweb/5114131
and also this one
https://gist.github.com/webaware/6260468
But it still produces the same output. I really don't know why it only increments one item to the cart. I have checked the browser console for any errors and also have commented out some parts of the code to ensure or let you know that I have tried different methods or options in making the functionality work
Follow these steps
Uncomment woocommerce_quantity_input();
Check in Browser Console, if there are any errors in console or not. If yes, then please share your errors here.
If there are no errors then replace
woocommerce_template_loop_add_to_cart( $crate_products->post, $product );withprint_r(woocommerce_template_loop_add_to_cart( $crate_products->post, $product ));
and check whether it returns any data or not.
Also try uncommenting do_action( 'woocommerce_after_shop_loop_item' );
Here is an updated version.
<?php
/*
* Template Name: Home
*/
get_header(); ?>
<section class="full-width home-template">
<div class="full-width shop-section">
<div class="container">
<?php
global $product;
$args = array(
'post_type' => 'product',
'meta_query' => array(
array(
'key' => '_stock_status',
'value' => 'instock'
)
)
);
$posts = get_posts( $args );
foreach( $posts as $post ) :
setup_postdata( $post );
wc_setup_product_data( $post );
$product = wc_get_product( $post->ID ); ?>
<div id="post-<?php the_ID() ?>" class="three columns product-post">
<figure class="featured-image">
<a href="<?php the_permalink()?>" ><?php echo woocommerce_get_product_thumbnail(); ?></a>
</figure>
<h2 class="product-price"><?php wc_get_template( 'single-product/price.php' ); ?></h2>
<span class="product-name"><?php the_title(); ?></span>
<?php woocommerce_quantity_input(); ?>
<div class="add-to-cart-btn">
<?php woocommerce_template_loop_add_to_cart(); ?>
</div>
</div>
<?php endforeach; ?>
<script type="text/javascript">
(function($){
$(document).ready(function(){
$(document).on( "keyup", "input.qty", function(){
$(this).parent().next().find("a").attr( "data-quantity", $(this).val() );
});
});
})(jQuery);
</script>
</div>
</div>
</section>
<?php get_footer(); ?>
<?php // woocommerce_quantity_input(); ?>
Should be
<?php woocommerce_quantity_input(); ?>
I have a custom post type "events" and I want to display the events in a table of 3 columns with pagination using code in wordpress.
This is what I did so far but that displays it as a list.
$loop = new WP_Query( array( 'post_type' => 'events' , 'posts_per_page' => 3) );
$count = $loop->post_count;
if ( $loop->have_posts() ) :
?>
<h2 style="position:relative;top:100px" align="center"> News & Events</h2>
<div id = "menu" style="position:relative;top:100px;left:350px">
<ul>
<li class = "aa"><a class="anchor" id="all" href="#">All</a></li>
<li class = "aa"><a class="anchor" id ="videos" href="#">Videos</a></li>
<li class = "aa"><a class="anchor" name = "links" id="links" href="#">Links</a></li>
<li class = "aa"><a class="anchor" id = "our events" name ="our events" href="#">Our Events</a></li>
</ul>
</div>
<br>
<br><br>
<?php
while ( $loop->have_posts() ) : $loop->the_post(); ?>
<div class="pindex" style="position:relative;top:100px;left:-450px">
<?php if ( has_post_thumbnail() ) { ?>
<div class="pimage">
<?php the_post_thumbnail(); ?>
</div>
<?php } ?>
<div class="ptitle">
<h2><?php
echo get_the_title() ?></h2>
<div style="width:20%;position:relative;top:10px;left:550px" ><?php echo the_content();?> </div>
</div>
</div>
<?php
endwhile;
if ( $loop->max_num_pages > 1 ) : ?>
<div id="nav-below" class="navigation">
<div class="nav-previous"><?php next_posts_link( __( '<span class="meta-nav">←</span> Previous', 'domain' ) ); ?></div>
<div class="nav-next"><?php previous_posts_link( __( 'Next <span class="meta-nav">→</span>', 'domain' ) ); ?></div>
</div>
<?php endif;
endif;
wp_reset_postdata();
Can someone help me with this?
You use this method for display custom post events and pagination as it is
$args = array(
'post_type' => 'events',
'posts_per_page' => 3
);
$posts_array = get_posts( $args );
// print_r($posts_array);
foreach ( $posts_array as $post ){
echo $post->ID;
}
Hi i have this template in wordpress, i would like to just display 10 items, because right now in general options in wordpress i have 5 items but i would like to make an exception with this template i dont know where i have to modify the code in order to show in this template 10 items:
<?php
/*
Template Name: Blog List
*/
?>
<?php get_header(); ?>
<div class="content-wrap">
<div class="content">
<?php tie_breadcrumbs() ?>
<div id="content" class="podcast_archive">
<!--<div class="podcast_full">-->
<?php if ( have_posts() ) : ?>
<header><meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<h1><?php _e( 'El Jurado del Pueblo' , 'ss-podcasting' ); ?></h1>
</header>
<?php
$feed_url = trailingslashit( home_url() ) . '?feed=podcast';
$custom_feed_url = get_option('ss_podcasting_feed_url');
if( $custom_feed_url && strlen( $custom_feed_url ) > 0 && $custom_feed_url != '' ) {
$feed_url = $custom_feed_url;
}
$itunes_url = str_replace( array( 'http:' , 'https:' ) , 'itpc:' , $feed_url );
?>
<section>
<?php
/* Start the Loop */
while ( have_posts() ) : the_post(); ?>
<?php
$terms = wp_get_post_terms( get_the_ID() , 'series' );
foreach( $terms as $term ) {
$series_id = $term->term_id;
$series = $term->name;
break;
}
?>
<article class="podcast_episode">
<?php if( has_post_thumbnail() ) { ?>
<?php $img = wp_get_attachment_image_src( get_post_thumbnail_id() ); ?>
<a>" title="<?php the_title(); ?>">
<?php the_post_thumbnail( 'podcast-thumbnail' , array( 'class' => 'podcast_image' , 'alt' => get_the_title() , 'title' => get_the_title() ) ); ?>
</a>
<?php } ?>
<h3>
<strong><?php the_title(); ?></strong>
<div class="podcast_meta"><?php echo $series; ?><aside></div>
</h3>
<div id="audio">
<?php global $ss_podcasting;
$enclosure = $ss_podcasting->get_enclosure( get_the_ID() );
if( $enclosure ) {
$audio_player = $ss_podcasting->audio_player( $enclosure );
echo $audio_player;
} ?>
<?php the_content(); ?>
</div>
<div id="audioinfo">
<a>">Descargar Audio</a>
<span class="audiometa">
Tamaño: <?php echo get_post_meta(get_the_ID(), 'filesize', true) ?>
</span>
</div>
<?php echo do_shortcode('[divider]');?>
</article>
<?php
endwhile;
?>
</section>
<?php endif; ?>
<?php wp_pagenavi(); ?>
<div class="podcast_clear"></div>
</div>
<?php comments_template( '', true ); ?>
</div><!-- .content -->
<?php get_sidebar(); ?>
<?php get_footer(); ?>
?>
i would some advise so i can do it by myself :)
thank you very much
You'll want to use the query_posts() function for that, just before your loop.
global $wp_query;
$args = array_merge( $wp_query->query_vars, array( 'showposts' => '10' ) );
query_posts( $args );
http://codex.wordpress.org/Function_Reference/query_posts
You'd need to modify your template's query. I'd suggest making use of the WP_Query class. For example:
$args = array(
'posts_per_page' => 10
);
$the_query = new WP_Query( $args );
if ( $the_query->have_posts() ) {
while ( $the_query->have_posts() ) {
$the_query->the_post();
// Loop item here
}
wp_reset_postdata();
} else {
// No results found
}
if
$args = array(
'posts_per_page' => 10
);
not work than check at back-end under Setting->Reading there is a "Blog pages show at most" if there is 5 post than it display only 5 post.
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.