9 replies
  • WEB DESIGN
  • |
Okay I want to have a separate blog page that I only want the content (i.e articles) to show up on. I do not want them to appear with with the posts that contain the products I am promoting.

I created a custom page template called blog, but it shows all posts. How can I only show posts from a certain category (i.e content).

also how can I remove the "content" posts from the home page/post page?

Thanks!
#custom #post #question #wordpress
  • Profile picture of the author Kezz
    The easiest way would be this:

    1. Under Settings > Reading, choose a page to act as your "Front page".

    2. Leave the "Posts page" field blank

    3. Create a custom menu under Appearance > Menus

    4. Choose your "Content" category from the list of categories on the left side (check the box under the top right "Screen Options" tab if you don't see it) and add it to your menu.

    5. Change the new menu item's label to read "Blog" instead of "Content".

    Now people will click the "Blog" item on your menu, and when they do they'll be taken to an area that shows only your "Content" category posts.
    {{ DiscussionBoard.errors[6876180].message }}
    • Profile picture of the author dylan151
      Originally Posted by Kezz View Post

      The easiest way would be this:

      1. Under Settings > Reading, choose a page to act as your "Front page".

      2. Leave the "Posts page" field blank

      3. Create a custom menu under Appearance > Menus

      4. Choose your "Content" category from the list of categories on the left side (check the box under the top right "Screen Options" tab if you don't see it) and add it to your menu.

      5. Change the new menu item's label to read "Blog" instead of "Content".

      Now people will click the "Blog" item on your menu, and when they do they'll be taken to an area that shows only your "Content" category posts.
      Thanks I'll look into that. Will that keep the other post page (which is my front/home page) intact?
      {{ DiscussionBoard.errors[6876907].message }}
  • Profile picture of the author tarif
    Yes, like Kezz said, if you have followed the above procedure there you must have a separate category for "Content" (labeled as blog) should only be used for seperate blog page. Also you must exclude this category for homepage posts (Select specified category/categories instead of all category or only exclude "content" category). Hope this will solve your problem.
    {{ DiscussionBoard.errors[6877037].message }}
  • Profile picture of the author dylan151
    Okay. I tried doing the method posted above, but didn't think it worked for me.

    I created a php file called content with this code:
    Code:
    <?php /* Template Name: Content */ ?>
    <?php get_header(); ?>
    
    <div id="content">
    
        <div id="contentleft">
        
            <div class="postarea">
        
            <?php include(TEMPLATEPATH."/breadcrumb.php");?>
                
                <?php query_posts('category_name=content'); ?>
    <?php while (have_posts()) : the_post(); ?>
    <a href="<?php the_permalink(); ?>">
    <?php the_title(); ?>
    </a>
    <?php endwhile; ?>
            
                
                
                    
            </div>
            
        </div>
        
    <?php include(TEMPLATEPATH."/sidebar.php");?>
            
    </div>
    
    <?php // The main column ends  ?>
    
    <?php get_footer(); ?>
    This makes a page that will only show posts with category content. The only problem is that it only shows the post's title with no preview. How can I fix this? I used the page.php for this file.
    {{ DiscussionBoard.errors[6883661].message }}
    • Profile picture of the author lazypuppy
      Originally Posted by dylan151 View Post

      Okay. I tried doing the method posted above, but didn't think it worked for me.

      I created a php file called content with this code:
      Code:
      <?php /* Template Name: Content */ ?>
      <?php get_header(); ?>
      
      <div id="content">
      
          <div id="contentleft">
          
              <div class="postarea">
          
              <?php include(TEMPLATEPATH."/breadcrumb.php");?>
                  
                  <?php query_posts('category_name=content'); ?>
      <?php while (have_posts()) : the_post(); ?>
      <a href="<?php the_permalink(); ?>">
      <?php the_title(); ?>
      </a>
      <?php endwhile; ?>
              
                  
                  
                      
              </div>
              
          </div>
          
      <?php include(TEMPLATEPATH."/sidebar.php");?>
              
      </div>
      
      <?php // The main column ends  ?>
      
      <?php get_footer(); ?>
      This makes a page that will only show posts with category content. The only problem is that it only shows the post's title with no preview. How can I fix this? I used the page.php for this file.
      After
      Code:
      <a href="<?php the_permalink(); ?>">
      <?php the_title(); ?>
      </a>
      and before
      Code:
      <?php endwhile; ?>
      add this
      Code:
      <?php the_excerpt() ?>
      This will show the excerpt of each post.
      {{ DiscussionBoard.errors[6888157].message }}
  • Profile picture of the author alfiecharleng
    Hey you have to create blog, means on home page there is my blog tab is there ..from there, you create your new post..
    {{ DiscussionBoard.errors[6896034].message }}
  • Profile picture of the author jharri
    Make sure you catch the underscore in this code -
    <?php the_excerpt() ?>

    other wise it will abend.
    {{ DiscussionBoard.errors[6912050].message }}

Trending Topics