Page 1 of 2 12 LastLast
Results 1 to 10 of 13

Thread: Custom WP Template pages

  1. #1
    Thread Starter
    Member arturocivit's Avatar
    Join Date
    Jul 2011
    Location
    United States
    Posts
    66
    Thanks
    8
    Thanked 0 Times in 0 Posts

    Custom WP Template pages

    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:

    Code:
    <?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 code on that page is:
    Code:
    <?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 -->
    So, not really sure what I'm doing wrong, any idea guys?

    Thanks so much!

    A.-

  2. #2
    Veteran bluecafe's Avatar
    Join Date
    Apr 2010
    Location
    Berlin
    Posts
    1,563
    Thanks
    58
    Thanked 359 Times in 273 Posts
    If you edit your home page with the page template and click on "view". Can you see the page correctly?

  3. #3
    Thread Starter
    Member arturocivit's Avatar
    Join Date
    Jul 2011
    Location
    United States
    Posts
    66
    Thanks
    8
    Thanked 0 Times in 0 Posts
    Hi there, thanks for the reply, I can see the new template running but not the content. So, still not sure what I'm doing wrong.....


  4. #4
    Veteran bluecafe's Avatar
    Join Date
    Apr 2010
    Location
    Berlin
    Posts
    1,563
    Thanks
    58
    Thanked 359 Times in 273 Posts
    Do you have a link to your site? The content is rendered by the tag <?php the_content(); ?>
    If you have entered any content it should appear otherwise there must be something wrong with the template.

  5. #5
    Thread Starter
    Member arturocivit's Avatar
    Join Date
    Jul 2011
    Location
    United States
    Posts
    66
    Thanks
    8
    Thanked 0 Times in 0 Posts
    Actually, it is here Concentric

    But is calling some post, not the page content I created in the back end, I created a page named Welcome, then, assigned the template and in general -> reading I selected as landing page a static page and selected the recently created one but is not working.

  6. #6
    Veteran bluecafe's Avatar
    Join Date
    Apr 2010
    Location
    Berlin
    Posts
    1,563
    Thanks
    58
    Thanked 359 Times in 273 Posts
    If your page is calling a post there might be an error in your custom query if no content shows up.

  7. #7
    Thread Starter
    Member arturocivit's Avatar
    Join Date
    Jul 2011
    Location
    United States
    Posts
    66
    Thanks
    8
    Thanked 0 Times in 0 Posts
    Then I don't know as fasr as I can see everything here is fine:

    Code:
    		<?php
    			/*
    			Template Name: Home Template
    			*/
    			?>
                
    			<!--Header Start -->
                
    			<?php get_header(); ?>
                
                <!--Content 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_content(); ?>
                <div><hr /><br /></div>
    
         
            	</div>
           
          
          		</div>
                
                <!--Main Content End -->
                
                
                
             
                
                
                
                
                <!--Footer Start -->
                
                <?php get_footer(); ?>
    			
                <!--Footer End -->

  8. #8
    Veteran bluecafe's Avatar
    Join Date
    Apr 2010
    Location
    Berlin
    Posts
    1,563
    Thanks
    58
    Thanked 359 Times in 273 Posts
    Where is your query calling a post? This is a PAGE template assigned to a PAGE. You cannot assign a page template to a post without a custom query calling a certain category.

  9. #9
    Thread Starter
    Member arturocivit's Avatar
    Join Date
    Jul 2011
    Location
    United States
    Posts
    66
    Thanks
    8
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by bluecafe View Post
    Where is your query calling a post? This is a PAGE template assigned to a PAGE. You cannot assign a page template to a post without a custom query calling a certain category.
    I see, however that confuses me, for example, regular template is calling the posts with this:

    Code:
                <?php query_posts($query_string . '&cat=-3'); ?>
    			<?php if(have_posts()) : while(have_posts()) : the_post(); ?>
    			<? if ($post->ID != $featured_ID) { ?>
    I think in that case is excluding category 3, however, how to call what is a page? because it's a page what I want to appear in the home page.

    Also, that's a loop, I don't want a loop because is just one page I'm calling.

  10. #10
    Veteran bluecafe's Avatar
    Join Date
    Apr 2010
    Location
    Berlin
    Posts
    1,563
    Thanks
    58
    Thanked 359 Times in 273 Posts
    Quote Originally Posted by arturocivit View Post
    I think in that case is excluding category 3, however, how to call what is a page? because it's a page what I want to appear in the home page.
    If you add a new PAGE in the backend, the content automatically will be a new PAGE.
    If you add a new ARTICLE the content will be a new POST.
    If you add a new AD in classipress the content will be a new CUSTOM POST TYPE "Ad".

    A page has a loop too (see page.php). Pages do not loop articles from a certain category but just the page content which is what you want to achieve.

    If you want to create a page template it MUST HAVE a loop. It is probably the best if you create your page template from the existing page.php.

Page 1 of 2 12 LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Code for custom field in edit resume template
    By bluesalman in forum JobRoller General Discussion
    Replies: 8
    Last Post: November 29th, 2011, 07:46 PM
  2. Child theme template pages?
    By tyles2 in forum ClassiPress General Discussion
    Replies: 1
    Last Post: November 4th, 2011, 04:04 PM
  3. Template turns white even after deleting and reactiving the theme template
    By postgrabber in forum ClassiPress General Discussion
    Replies: 6
    Last Post: August 28th, 2011, 08:20 AM
  4. Can WP short code be used in theme template pages?
    By dollarpermile.com in forum Help Using ClassiPress
    Replies: 5
    Last Post: June 1st, 2010, 12:58 AM