Support » Fixing WordPress » Blog page with a single category

  • My goal is to create 2 different blog pages, each one gets the posts from a single catogory. I’ve wandered around the forum but haven’t found the solution.

    This is how my page-blog.php looks like:

    Template Name: Blog with Single Category
    <?php get_header() ?>
    	        <div class="clear40"></div>
                <!--side bar title and bread crumb-->
                <div class="center-clear">
                    <div id="breadcrumb" class="page-columns-head-style gray-frame page-column2">
    					<?php if (function_exists('dimox_breadcrumbs')) dimox_breadcrumbs(); ?>                    
                    <div class="page-columns-head-style gray-frame page-column1 margin-left-10">
                    	<h1 class="heading h1"><?php _e('Categories','th_incorporate') ?></h1>
                <!--/side bar title and bread crumb-->
    		<!--page content wrapper-->
            <div id="page-content-wrapper">        
                <!--content container-->
              	<div class="center-clear page-content-wrapper">
                    <!--page content goes here-->
                	<div class="page-content gray-frame nopadding blog-content">
    					<div class="clear10"></div>
                        //global $post;
                        global $more;    // Declare global $more (before the loop).
                        $args = array(
    						'meta_query' => array(
    							array('key' => 'incorporate_post_type',	'value' => '4columngallery', 'compare' => '!='),
    							array('key' => 'incorporate_post_type',	'value' => 'news', 'compare' => '!='),
    							array('key' => 'incorporate_post_type',	'value' => 'special', 'compare' => '!=')
                            'post_type' => array('post'),
    						'showposts' => get_option('posts_per_page'), 
    						'paged' => $paged
                        //$myposts = get_posts( $args );
    					global $wp_query;
    					$myposts = query_posts( $args );
                        foreach( $myposts as $post ) :	setup_postdata($post); 	$more = 0; ?>
                        <div class="post-box">
                            <!--date box-->
                            <div class="date-box alignleft_block">
                                    <span class="line1"><?php the_time('d')?></span>
                                    <span class="line2"><?php the_time('M')?></span>
                                    <span class="line3"><?php the_time('Y')?></span>
                            <!--/date box-->
                            <h1 class="alignleft_block margin-left-20 heading post-title"><?php the_title(); ?></h1>
        					<!--post content-->
                            <div class="alignleft_block post-content margin-left-20">
                            <!--/post content-->
                            <div class="clear10"></div>
                            <!--
                            <a>" class="alignright_block button"><?php _e('READ MORE','th_incorporate')?></a>
                            <!--/
                            <div class="clear20"></div>
                            <!--information bar-->
                            <div class="info-bar alignleft_block">
                            	<span class="posted-by"><?php _e('Posted by ','th_incorporate'); the_author_posts_link(); ?></span>
                                <span class="tags"><?php _e('Tags : ','th_incorporate'); the_tags('',', '); ?></span>
                                <span class="comments notextdecoration gray-only"><?php comments_number( __('No Comment','th_incorporate'), __('One Comment','th_incorporate'), '(%) '.__('Comments','the_incorporate') ); ?></span>                            
                                <div class="social">
                                	<!--add this-->
                                    <div class="addthis_toolbox addthis_default_style" addthis:url="<?php the_permalink() ?>" addthis:title="<?php the_title() ?>" addthis:description="">
                                    <!--/add this-->
                            <!--/information bar-->
                        <div class="clear10"></div>
    					<?php endforeach; ?>
    					<?php get_pagination('<div class="paging-wrapper blog gray-frame">','</div>'); ?>
                    <!--/page content goes here-->                
    				<?php get_sidebar('blog'); ?>
                <!-- /content container-->
    	        <div class="clear40"></div>
            <!--/page content wrapper-->
    <?php get_footer() ?>

    Pretty long, isn’t it?

    And just to know, I don’t want to add category straight to the menu, I just want to use Blog.

    [No bumping. If it’s that urgent, consider hiring someone.]

Viewing 3 replies - 1 through 3 (of 3 total)
  • The Blog In Blog plugin might do what you want.

    Thanks, it works well, I really can manage from here but this plug-in uses it’s own template, is there any way that I can use my own blog template?

    Blog In Blog has its own templates. Go to Admin->Settings->Blog-in-Blog->Template and enter the template code there.

    Much of the code can be copied from your ‘Blog with Single Category’ template shown above. You will just need the code that displays a single post in the template.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Blog page with a single category’ is closed to new replies.