Support » Themes and Templates » Exempting "About Me" page from page template

  • Resolved Janetis


    I’ve set up my site so that the blog updates on a page instead of home. However, there is a page that I would like to exempt from the blog format: my “About Me” page. I’m not sure of the easiest way to go about this.

    Voilà the site:

    Notice: when you click the link that says, “Blog,” you get my blog, but if you click “Janet,” same thing unfortunately!

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hi,

    you will need to be more specific about this.

    can you tell me how did you do so the posts are displaying on “Blog” page instead of “Home”? Did you make a new template php file, or did you just switched options in Admin > Settings > Reading?

    PS. I had to google to find out what “exempt” means.

    I altered the original page.php thus-ly:

    <?php get_header(); ?>
    	<div class="single_content">
            $args = array(
                         'category_name' => 'blog',
                         'post_type' => 'post',
                         'posts_per_page' => 4,
                         'paged' => ( get_query_var('paged') ? get_query_var('paged') : 1),
            while (have_posts()) : the_post(); ?>            
            <div class="blog_box">
    	<h3><a href="<?php the_permalink(); ?>" class="img_hover_trans"><?php the_title(); ?></a></h3>
    		   <a href="<?php the_permalink(); ?>" class="img_hover_trans"><?php the_post_thumbnail('featured-blog-listing'); ?></a>
            <p><?php $temp_arr_content = explode(" ",substr(strip_tags(get_the_content()),0,430)); $temp_arr_content[count($temp_arr_content)-1] = ""; $display_arr_content = implode(" ",$temp_arr_content); echo $display_arr_content; ?><?php if(strlen(strip_tags(get_the_content())) > 430) echo "[.....]"; ?></p>
            <?php endwhile; ?>
            <div class="navigation">
              <div class="left"><?php previous_posts_link('« Previous') ?></div>
              <div class="right"><?php next_posts_link('Next »') ?></div>
              <div class="clear"></div>
            <?php wp_reset_query(); ?>                  
            <?php get_sidebar(); ?>
          <div class="clear"></div>
    <?php get_footer(); ?>

    Would I need to create another page template for the “About Me?” I’m trying the avoid that, since its not entirely clear to me how one adds a new template to an already-uploaded theme on WordPress without taking everything down, adding needed page, then uploading everything again. If possible, I’d like to write something in page.php that recognizes “Janet” must be formatted alternatively.

    Unfortunately what you did, you altered “page.php” file which is used for every new page you make through admin panel. You need to understand that in first place. Page.php is template used for every new Page you make in admin panel, single.php is template used for displaying a single post, index.php of course for front page.
    So the best way is to design your page.php in a way that is okay for every new page you create in Admin panel (ex. About me). It should be similar to index.php. The best way is just to copy everything from index.php and just alter it to suits your needs. Then you can easily write whatever you want, and it will be shown.

    Currently it cant do that, cause you altered it to just show posts, and now every new page you make will be the same, just posts.

    What you need to do is actually easy. You just need to make a new PHP file inside of your theme folder, ex. blog.php, and whats important is this line of code

    Template Name: Blog

    Rest of that file can be the same as your altered page.php which means you can just copy paste it. Then go to Admin panel, Add new page called Blog (or do it for the one you already have). You should now see your custom template name appear under the “Template” pull-down in the Page Edit screen, as indicated in the pic below by the green arrow.

    When you have your blog.php up and working correctly, you should redesign page.php (note that once you have blog.php, you can clear your query_posts code from page.php)

    Thank you thank you! Works perfectly.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Exempting "About Me" page from page template’ is closed to new replies.