• Hello! I created a blog page for my blog posts. I copied the index template as suggested and created a new file with blogtemplate.php. I edited some lines as instructed. But then after setting up the page, when i click on the blog page. I get this error: Parse error: syntax error, unexpected $end in /home/nina9702/public_html/izah/wp-content/themes/twentyeleven/blogtemplate.php on line 26
    I don’t know how I can find the line 26 as indicated. Here’s my code `<?php
    /*Template Name: blog page*/
    ?>
    <?php get_header(); ?>

    <div id=”primary”>
    <div id=”content” role=”main>
    <?php if ( have_posts() ) : ?>
    <?php twentyeleven_content_nav( ‘nav-above’ ); ?>
    <?php /* Start the Loop */ ?>
    <?php
    $temp = $wp_query;
    $wp_query= null;
    $wp_query = new WP_Query();
    $wp_query->query(‘posts_per_page=5′.’&paged=’.$paged);
    while ($wp_query->have_posts()) : $wp_query->the_post();
    ?>

    <?php get_template_part( ‘content’, get_post_format() ); ?>
    <?php twentyeleven_content_nav( ‘nav-below’ ); ?>
    <?php $wp_query = null; $wp_query = $temp;?>

    </div><!– #content –>
    </div><!– #primary –>
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>`

Viewing 5 replies - 1 through 5 (of 5 total)
  • This seems to work for me –

    <?php
    /*Template Name: blog page*/
    ?>
    <?php get_header(); ?>
    
    <div id="primary">
    <div id="content" role="main>
    <?php if ( have_posts() ) : ?>
    <?php twentyeleven_content_nav( 'nav-above' ); ?>
    <?php /* Start the Loop */ ?>
    <?php
    $temp = $wp_query;
    $wp_query= null;
    $wp_query = new WP_Query();
    $wp_query->query('posts_per_page=5'.'&paged='.$paged);
    while ($wp_query->have_posts()) : $wp_query->the_post();
    ?>
    
    <?php get_template_part( 'content', get_post_format() ); ?>
    <?php endwhile; ?>
    <?php twentyeleven_content_nav( 'nav-below' ); ?>
    <?php else : ?>
    <?php $wp_query = null; $wp_query = $temp;?>
    <?php endif; ?>
    </div><!-- #content -->
    </div><!-- #primary -->
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>
    Thread Starter tripadora

    (@tripadora)

    Hello Clayton!Thanks for the reply. my blog page is now working. But I found another problem. Only one post is appearing even if 5 was indicated in the code. There’s also no pagination. Hope you could help. thanks

    Thread Starter tripadora

    (@tripadora)

    Thanks for the help. I figured out that one of the plugins is causing it. I resolved it already.

    The code that I added a couple of lines to and posted above displays my 5 latest posts with functioning page navigation on my test site using Twenty Eleven. The only thing I did differently when I tested your template on my site, was removed<?php get_sidebar();? >. I’m not sure where to point you.

    [edit] Glad you got it working. Good luck to you!

    Hi, ClaytonJames, How do you display ASC?

    thanks

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘How to find syntax error parse error line’ is closed to new replies.