Forums

What is wrong with this page template? (7 posts)

  1. glass3atr
    Member
    Posted 1 year ago #

    Hello
    i'm trying to make a page template that gets posttitles and permalinks out of a certain cateory under the static homepage content.

    Can someone help to debug the code below. It results in unexpected $end.

    TIA

    <?php get_header(); ?>
    
    <div id="content" class="narrowcolumn">
    
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    <div class="post" id="post-<?php the_ID(); ?>">
    <h2><?php the_title(); ?></h2>
    <div class="entry">
    <?php the_content('<p class="serif">Read the rest of this page ยป
    '); ?>
    
    <?php wp_link_pages(array('before' => 'Pages: ', 'after' => '
    ', 'next_or_number' => 'number')); ?>
    
    </div>
    <?php if (is_page('Home'));?>
    <?php $posts = get_posts( "category=1&numberposts=6" ); ?>
    <?php if( $posts ) : ?>
    <?php foreach( $posts as $post ) : setup_postdata( $post ); ?>
    " rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?>
    </div>
    
    </div>
    </div>
    
    <?php get_sidebar(); ?>
    
    <?php get_footer(); ?>

    Edit by Otto: Attempted to fix backticks, but some of the post was already lost. Recommend using pastebin instead.

  2. adamrbrown
    Member
    Posted 1 year ago #

    * ahem *

    Put code in between backticks.

    Edit: Now that I look at it, it looks like you did use backticks, but they came out funny. Try pasting your code into here instead:

    http://wordpress.pastebin.ca/

  3. Otto42
    Moderator
    Posted 1 year ago #

    Just looking at it (incomplete though it is), I'd say that you're not closing your loops and if statements properly. There's a while(): but no endwhile, for example.

    Post the thing on pastebin and we'll try to correct it for you.

  4. moshu
    Member
    Posted 1 year ago #

    i'm trying to make a page template that gets posttitles and permalinks out of a certain cateory under the static homepage content.

    Maybe this helps?
    http://www.transycan.net/blogtest/2007/09/10/static-frontpage-combined-with-dynamic-content/

  5. glass3atr
    Member
    Posted 1 year ago #

    Hello,
    I pasted the code
    here
    Indeed I get lost in while and if loop.
    Thank you.

  6. Otto42
    Moderator
    Posted 1 year ago #

    This might do sorta what you're trying to do. It's hard to say, since the code you posted there was just as broken as the code you posted here.
    http://wordpress.pastebin.ca/813865

  7. glass3atr
    Member
    Posted 1 year ago #

    Yes thank you, this does what I needed, I will go and focus now on learning better code.

    Thanks again!

Topic Closed

This topic has been closed to new replies.

About this Topic