WordPress.org

Ready to get started?Download WordPress

Forums

Page for Posts (7 posts)

  1. nathan2o12
    Member
    Posted 1 year ago #

    Hi, having a big problem with my blog page :-/ I am trying to display a list of my blog posts on a page within my site called 'Blog' I Have created a separate template for this blog.php and attached the template to this page. However I am having trouble getting the page to show my list of blog posts.

    Whenever I type in my web address however on my first page I get a list of the blog posts (which is what I want just in the wrong page). However when I click on the hyperlink with the name of my blog post (which should take me to the post page, I get the error message 'Bad Request. Your browser sent a request that this server could not understand.' I am using permalinks custom structure with /%page% at the end. Not sure if this could be causing the problem.

    I have tried in my template .php file

    'code
    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>

    <h2>"><?php the_title(); ?></h2>

    <?php the_content(); ?>

    <p><?php the_time('F j, Y'); ?> at <?php the_time('g:i a'); ?> | <?php the_category(', '); ?> | <?php comments_number('No comment', '1 comment', '% comments'); ?></p>

    <?php comments_template(); // Get wp-comments.php template ?>

    <?php endwhile; else: ?>

    <h2>Woops...</h2>

    <p>Sorry, no posts we're found.</p>

    <?php endif; ?>
    code'

    but no joy. I get the form to post commends and a hyperlink at the top 'Blog' but when I click on it it just stays on the same page like the hyperlink is pointing to the current page.

    Any help you guys can offer would be greatly appreciated :)

    Thanks muchly :)

  2. Rajesh Soni
    Member
    Posted 1 year ago #

    Site URL Please?

  3. nathan2o12
    Member
    Posted 1 year ago #

    Im working off a local copy at present..

  4. Rajesh Soni
    Member
    Posted 1 year ago #

    I seriously doubt anyone would be able to help you with just this information.

  5. nathan2o12
    Member
    Posted 1 year ago #

    I just want to find out how I can have a blog page on my site listing the blog posts? The other problems I can hopefully troubleshoot myself..

    Thanks

  6. Rajesh Soni
    Member
    Posted 1 year ago #

    Okay have you read the documentation on WP_Query?

    https://codex.wordpress.org/Class_Reference/WP_Query

  7. nathan2o12
    Member
    Posted 1 year ago #

    Yes that was some help thanks. I done a test on my blog page and it is getting the correct template however I've noticed the comments page isnt getting applied to it, is there any reason this would be happening?

    Thanks

Topic Closed

This topic has been closed to new replies.

About this Topic