Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6867955
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T03:22:26+00:00 2026-05-27T03:22:26+00:00

I am rather new to WordPress and have a question. I have created my

  • 0

I am rather new to WordPress and have a question. I have created my own theme, which all seems to work fine. But, I am having one issue. I want to create my blog page (with all the posts) on a page other than my home page. So, in my theme folder, I created a page template called blog.php:

 <?php
  /*
  Template Name: blog  
  */
  ?>
  <?php get_header(); ?>

    <table id="about-table"  >
<tr>
    <td colspan="7">            
        <?php if (have_posts()) : while (have_posts()) : the_post();?>
            <?php the_title(); ?>
            <?php the_author(); ?>
            <?php the_time("jS F"); ?>
            <?php comments_number("0","1","%"); ?>
            <?php the_excerpt(); ?>
        <?php endwhile; endif; ?>
    </td>
</tr>
   </table> 
   <?php get_footer(); ?>   

Then, I created a page in wordpress called “blog” as well, in the “pages” section in the dashboard. I then assigned its template to the above “blog” template. The problem is, though, that the code does not work as it should. Instead of showing me the titles, comments, etc of the posts, it displays some other info. On the other hand, if i just copy this:

   <table id="about-table"  >
<tr>
    <td colspan="7">            
        <?php if (have_posts()) : while (have_posts()) : the_post();?>
            <?php the_title(); ?>
            <?php the_author(); ?>
            <?php the_time("jS F"); ?>
            <?php comments_number("0","1","%"); ?>
            <?php the_excerpt(); ?>
        <?php endwhile; endif; ?>
    </td>
</tr>
   </table> 

to my index page, it works fine. So, how do I display all my post info on a page other than the home page?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T03:22:27+00:00Added an answer on May 27, 2026 at 3:22 am

    How about you do something like this:

    blog-template.php:

    <?php/*
    Template Name: Blog Page
    */
    ?>
    
    <?php get_header(); ?>
    <?php get_template_part( 'layout-page', 'blog' );?>
    <?php get_footer(); ?>
    

    layout-page-blog.php:

    <?php 
    the_post();
    $title = get_the_title();
    $baselink = get_permalink();
    $category = get_field('category_blog'); 
    
    if( !empty($category) ){
        $post_per_page = get_option('posts_per_page'); 
        $paged = (get_query_var('page')) ? get_query_var('page') : 1;
    
        $categoryID = get_category_id($category);
    
        $total = get_post_count(array($categoryID));
    
        $the_query = new WP_Query("posts_per_page={$post_per_page}&cat=    {$categoryID}&paged={$paged}");
    ?>
    
    <div id="wrapper">
    <div id="content">
        <h1 class="title"><?php echo $title; ?></h1>
        <div class="content-middle">
            <div class="node">              
                <?php while ( $the_query->have_posts() ) : $the_query->the_post();  ?>
                <h3><a href="<?php echo get_permalink(); ?>"><?php the_title(); ?></a></h3>
                <div class="content">
                    <?php echo content(150); ?>
                </div>
                <div class="read-more"><a href="<?php echo get_permalink(); ?>">Read more</a></div>                     
                <?php endwhile; ?>
                <br/><br/>
                <div class="wp-paginate">
                <?php 
                    wp_reset_query();
    
                    echo paginate_links( array(
                        'base' => $baselink.'%_%',
                        'total' => ceil($total/$post_per_page),
                        'current' => $paged,
                    ));
    
                    ?>
                </div>
            </div>
        </div>
    
    </div> <!-- end content -->
    
    <div style="clear:both"></div>
    </div>
    
    <?php
    }
    ?>
    

    This could all be in one file, or you can use it in two pieces as I have written it.

    EDIT:

    Sorry I have it set to also grab the images from the post. I think this is the functions code you need:

    function get_images_by_cat($id){
        $limit = 1000;
    
        $the_query = new WP_Query("posts_per_page={$limit}&cat={$id}");
        $arr = array();
        while ( $the_query->have_posts() ) { 
            $the_query->the_post();
    
            $title = get_the_title();
            $image_src = get_field('banner_image');
            $image_link = get_field('banner_link');
    
            $arr[] = array(
                "title" => $title,
                "link" => $image_link,
                "image" => $image_src,
            );
        }
    
        wp_reset_query();
    
        return $arr;    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working on a wordpress theme, and I have a rather unique structure that
I'm rather new to JAXB and have come across a problem which I can't
Hi guys I am rather new at AJAX programming but I have managed to
I'm rather new to Ant but I have experienced it's quite good pattern to
I have a Wordpress Multisite which was working fine until I migrated the instance
I'm rather new to jQuery and have a quick question. I have two jQuery
Im rather new to python but I have been attemping to learn the basics.
I am rather new to socket programming but here goes nothing. I have been
Rather new to php, so sorry if this seems stupid. I'm really copying a
I'm rather new to Django and I'm using Django 1.0. I have this: forms.py:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.