Navigation for pages template
-
Hi there!
I am working on a website, that uses pages as navigation, e.g. a kind of CMS.
I have managed everything, except the display of the pages in my template.
Basically, the template works similar to the index.php, but as it is a page, I had to do a trick to get the blog postings into that page template.
This is why I do not use The Loop and I assume that the normal navigation does not work because of that.
Here is the code for the template, perhaps anyone knows how to implement a navigation similar to the pagebar plugin?<?php /* Template Name: Aktuelles Template */ ?> <?php get_header(); if (!get_option('mandigo_nosidebars') && get_option('mandigo_sidebar1_left')) include (TEMPLATEPATH . '/sidebar.php'); if (!get_option('mandigo_nosidebars') && get_option('mandigo_1024') && get_option('mandigo_3columns') && get_option('mandigo_sidebar2_left')) { include (TEMPLATEPATH . '/sidebar2.php'); } ?> <td id="content" class="narrowcolumn"> <?php $lastposts = get_posts(''); foreach($lastposts as $post) : setup_postdata($post); ?> <div class="post" id="post-<?php the_ID(); ?>"> <div class="postinfo"> <div class="calborder"> <div class="cal"> <span class="cald<?php echo (get_option('mandigo_dates') ? ' cald2' : '') ?>"><?php the_time((get_option('mandigo_dates') ? 'M' : 'd')) ?></span> <span class="calm"><?php the_time((get_option('mandigo_dates') ? 'd' : 'm')) ?></span> <span class="caly"><?php the_time('Y') ?></span> </div> </div> <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php printf(__('Permanent Link to %s','mandigo'),the_title('','',false)); ?>"><?php the_title(); ?></a></h2> <small><?php printf(__('Posted by: %s in %s','mandigo'),mandigo_author_link(get_the_author_ID(),get_the_author()),get_the_category_list(', ')) ?></small> </div> <div class="entry"> <?php the_content(__('Read the rest of this entry','mandigo') .' »'); ?> </div> <p class="postmetadata"><img src="<?php echo get_bloginfo('stylesheet_directory'); ?>/images/<?php echo get_option('mandigo_scheme'); ?>/comments.gif" alt="Comments" /> <?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »', '', ''); ?> <?php global $wpdb, $table_prefix, $wp_query; $post_id = $wp_query->post->ID; $num_comments = $wpdb->get_var(" SELECT COUNT(1) FROM {$table_prefix}comments WHERE comment_post_ID = " . $post_id . " AND comment_approved = '1' "); if($num_comments == "0"){?> Keine Kommentare <?php } else if($num_comments == "1"){ ?> <a href="<?php the_permalink() ?>#comments" title=" <?php printf(__('Kommentar zu %s','mandigo'),the_title('','',false)); ?>"><?php echo $num_comments ?> Kommentar »</a> <?php } else { ?> <a href="<?php the_permalink() ?>#comments" title=" <?php printf(__('Kommentar zu %s','mandigo'),the_title('','',false)); ?>"><?php echo $num_comments ?> Kommentare »</a> <?php } ?> </p> </div> <?php endforeach; ?> <div class="navigation"> <div class="alignleft"><?php next_posts_link('« Vorherige Einträge') ?></div> <div class="alignright"><?php previous_posts_link('Nächste Einträge »') ?></div> </div> </td> <?php if (!get_option('mandigo_nosidebars') && !get_option('mandigo_sidebar1_left')) include (TEMPLATEPATH . '/sidebar.php'); if (!get_option('mandigo_nosidebars') && get_option('mandigo_1024') && get_option('mandigo_3columns') && !get_option('mandigo_sidebar2_left')) { include (TEMPLATEPATH . '/sidebar2.php'); } get_footer(); ?>
Sorry for posting the whole code, but there’s no option to attach a file and I guess without the full code, something maybe missed.
- The topic ‘Navigation for pages template’ is closed to new replies.