WordPress.org

Forums

Problem creating a new template page (7 posts)

  1. arturocivit
    Member
    Posted 3 years ago #

    Hi there, well, finally I decided to start learning how to create custom themes, and I think I'm doing great, however I'm stuck with something, I created a template page with the name of homepage.php, the idea is to have this page as front page when it's template is selected to a "home" page, so, I added the template tag by placing:

    <?php /* Template Name: Homepage */ ?>

    At the very top, then, created the page "home" on WP and assigned that template, finally, on Settings -> Reading and selecting "A Static Page" and then choosing the page Home, the thing is, is not working, in the home page I'm having this text: Not Found - Not Found - Sorry, but you are looking for something that isn't here.

    So I don't know what's going on, the rest of the pages using the regular and by default template are working fine, but not this one, actually, it calls the footer and the header pefectly, but is not working with the content area, my content area on that page is:

    <!--main Content Start -->
    
                <div class="clr"></div>
    
    			<div class="content">
    
        		<div class="content_resize">
          		<div class="widebar">
            	<div class="article">
    
                <h2><?php the_title(); ?></h2>
              	<div class="clr"></div>
    
              	<?php the_post_thumbnail(); ?>
              	<div class="clr"></div>
    
              	<?php the_content(); ?>
                <div><hr /><br /></div>
    
            	</div>
    
          		</div>
    
                <!--Main Content End -->

    So, not really sure what I'm doing wrong, any idea guys?

    Thanks so much!

    A.-

  2. csleh
    Member
    Posted 3 years ago #

    How frustrating. This bit of code doesn't have the loop, is that outside the sample pasted?

    <?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
    ... do stuff
    <?php endwhile; ?>

    I've done that before and about tore my hair out for an hour. If that isn't it, have you tried copying all the content of your post or page template into this file?

  3. arturocivit
    Member
    Posted 3 years ago #

    Hi there, thanks for the reply, well, actually I tried pasting the content in the pafe directly and worked, so, that confuses me even more, here's the entire code Im using on that page:

    <?php /* Template Name: Homepage */ ?>
    
    <!--Header Start -->
    
    <?php get_header(); ?>
    
    <!--Header End -->
    
    <!--main Content Start -->
    
    <div class="clr"></div>
    
    <div class="content">
    
    <div class="content_resize">
    <div class="widebar">
    <div class="article">
    
    <h2><?php the_title(); ?></h2>
    <div class="clr"></div>
    
    <?php the_post_thumbnail(); ?>
    <div class="clr"></div>
    
    <?php the_content(); ?>
    <div><hr /><br /></div>
    
    </div>
    
    </div>
    
    <!--Main Content End -->
    
    <!--Footer Start -->
    
    <?php get_footer(); ?>
    <!--Footer End -->

    Thanks a lot!!

    Arturo

  4. arturocivit
    Member
    Posted 3 years ago #

    Any help please?

    Thanks in advance!

    Arturo

  5. csleh
    Member
    Posted 3 years ago #

    try adding the loop in like this:

    <!--main Content Start -->
    <?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
    <div class="article">
    <h2><?php the_title(); ?></h2>'
    
    then end it here:
    '</div>
    <!--Main Content End -->
    <?php endwhile; ?>
    <!--Footer Start -->
  6. arturocivit
    Member
    Posted 3 years ago #

    Thanks so much, but that is not working, I don't know what I'm doing wrong here :(

    This is what I added:

    <?php query_posts($query_string . '&cat=-3'); ?>
    			<?php if(have_posts()) : while(have_posts()) : the_post(); ?>
    			<? if ($post->ID != $featured_ID) { ?>
    
                <h2><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h2>
              	<div class="clr"></div>
              	<p>Posted on <?php the_time('M d'); ?> | by <b><?php the_author(); ?></b> | under <?php the_category(', '); ?> | <?php comments_number('No Comments', 'One Comment', '% Comments' );?></p>
    
              	<?php the_post_thumbnail(); ?>
              	<div class="clr"></div>
    
              	<?php the_content('<br />Read More'); ?>
                <div><hr /><br /></div>
    
    			<? } ?>
    			<?php endwhile ?>
                <div id="posts_navigation">
                <?php previous_posts_link(); ?>
                <?php next_posts_link(); ?>
                </div>
                <?php else : ?>
                <h2 class="center">Not Found</h2>
                <p class="center">Sorry, but you are looking for
                something that isn't here.</p>
                <?php include (TEMPLATEPATH . '/searchform.php'); ?>
                <?php endif; ?>
    </pre>
  7. arturocivit
    Member
    Posted 3 years ago #

    Any help please, ideas?

    Thanks so much!

    A.-

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.