• Resolved dekraan

    (@dekraan)


    Hello, please take a look at my site. I want to make a page that simply displays all posts, no matter what category, starting with the most recent. to do this, I made a template (named blog) and a page (on my site, this is temporatily the page ‘contact’). I set this page to have the template ‘blog’. Unfortunately I must be doing something wrong in the coding. Since I am not good at this, I hope anyone here can help me. This is the code from the template ‘Blog’.

    <?php /*
    	Template Name: Blog
    */ ?>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    	<head profile="http://gmpg.org/xfn/11">
    		<title><?php bloginfo('name'); ?> <?php if ( is_single() ) { ?> &raquo; Blog Archive <?php } ?> <?php wp_title(); ?></title>
    
    		<!-- Meta -->
    		<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />
    		<meta name="generator" content="WordPress <?php bloginfo('version'); ?>" /> <!-- leave this for stats -->
    		<meta name="keywords" content="<?php bloginfo('description'); ?>" />
    		<meta name="description" content="<?php bloginfo('description'); ?>" />
    
    		<!-- Stylesheets, XML &amp; Pingback -->
    		<link rel="stylesheet" href="<?php bloginfo('stylesheet_directory');?>/style.css" type="text/css" media="screen" />
    		<link rel="alternate" type="application/rss+xml" title="<?php bloginfo('name'); ?> RSS Feed" href="<?php bloginfo('rss2_url'); ?>" />
    		<link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />
    
    		<!-- Javascripts -->
    		<script type="text/javascript" src="<?php bloginfo('stylesheet_directory');?>/top.js"></script>
    		<script type="text/javascript">
    		<!--//--><![CDATA[//><!--
    		   function m(el) {
    		      if ( el.defaultValue == el.value ) el.value = "";
    		}
    		//--><!]]>
    		</script>
    
    		<?php
    		// Category Sort options
    		global $categories_sort;
    		if(get_settings('Shade_sortcategories')!='')
    		{
    			$categories_sort = 'sort_column='. get_settings('Shade_sortcategories');
    		}
    
    		// Exclude Categories options
    		global $categories_to_exclude;
    
    		if(get_settings('Shade_excludecategories')!='')
    		{
    			$categories_to_exclude = 'exclude='. get_settings('Shade_excludecategories');
    		}
    		?>
    		<?php wp_head(); ?>
    <?php wp_head(); require("config.php"); ?>
    	</head>
    	<body>
    <?php global $more;?>
    		<div id="header">
    			<div class="header">
    				<a href="<?php echo get_option('home'); ?>/"><img src="<?php echo get_option('home'); ?>/wp-content/themes/shade/img/logo.gif" alt="Logo" /></a>
    <ul id="menu">
    <li><a href="<?php bloginfo('url'); ?>">Home</a></li>
    <li><a href="/blog/overons">Over Ons</a></li>
    <li><a title="Copyright information" href="/blog/watwedoen/">Wat We Doen</a></li>
    <li><a href="<?php echo get_category_link($blog_category_page); ?>">Blog</a></li>
    <li><a title="Copyright information" href="../contact">Contact</a></li>
    </ul>
    			</div>
    		</div>
    		<div class="intro">
    			<div style="margin:0 auto; width:960px;">
    				<form class="search-header" method="get" style="margin:0px;" action="<?php echo get_option('home'); ?>/">
    					<input value="See what you can find..." onfocus="if(this.value == 'See what you can find...') {this.value = '';}" onblur="if (this.value == '') {this.value = 'See what you can find...';}" style="margin:5px 0px 0px 10px;" type="text"  name="s" id="s" size="19" class="search-top" />
    					<input type="image" src="<?php echo get_option('home'); ?>/wp-content/themes/shade/img/spacer.gif" style="margin:0px; padding:0px; border:0px;width:30px;height:30px;" />
    				</form>
    				<div class="intro-title"><?php the_title2('', '', true, '46') ?></div>
    			</div>
    		</div>
    		<div id="container">
    			<div id="wrapper">
    				<?php include 'sidebar.php';?>
    				<div id="content" class="narrowcolumn">
    <?php query_posts('category_name=your_category_name');?>
    				<?php if (have_posts()) : ?>
    					<?php $post = $posts[0];  ?>
    					<div class="post">
    						<div class="entry">
    						<?php while (have_posts()) : the_post(); ?>
    							<div style="text-align:justify;">
    								<?php $more = 0;the_content(); ?>
    								<?php comments_template(); // Get wp-comments.php template ?>
    						<?php endwhile; ?>
    							</div>
    						</div>
    					</div>
    				<?php else : ?>
    					<?php include (TEMPLATEPATH . '/notfound.php');?>
    				<?php endif; ?>
    				</div>
    <?php get_footer(); ?>

    What is wrong with my code? I hope anyone wants to help. If requested, I can give more info, or access to my theme!

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘What is wrong: template to display all posts’ is closed to new replies.