Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

I need a page-template for a 2nd blog for a specific sategory. WordPress

  • REFUNDED

The theme I'm using has only one blog included: http://themes.truethemes.net/Sterling/blog.

I need to add a 2nd blog for a specific category. However I need it to be applied to the theme's "Left-Nav" page template.

I want to be able to simply create a new page, select the appropriate template and I'll have the 2nd blog.

It should list them in the same format as the included blog (title, snippet, date, pagination, etc)

Please provide whatever edit is needed (to the loop?) to achieve this. Here is the page template:


<?php
/**
* Template Name: Left Nav
*/

get_header();

get_template_part( 'template-part-page-slider', 'childtheme' ); ?>

<section id="content-container" class="clearfix">
<div id="main-wrap" class="clearfix">
<aside class="subnav_cont sidebar">
<div class="subnav">
<?php
global $post;
$custom_menu_slug = get_post_meta( $post->ID, 'truethemes_custom_sub_menu', true );

if ( empty( $custom_menu_slug ) ) :
wp_nav_menu( array( 'container' => false, 'theme_location' => 'Main Menu', 'walker' => new truethemes_sub_nav_walker() ) );
else :
echo '<ul>';
wp_nav_menu( array( 'container' => false, 'menu' => $custom_menu_slug, 'walker' => new truethemes_sub_nav_walker_two() ) );
echo '</ul>';
endif;
?>
</div><!-- end subnav -->

<?php // Check for selected sidebar, does not print anything if no sidebar has been selected.
$selected_sidebar = get_post_meta( $post->ID, 'sbg_selected_sidebar_replacement', true );
if ( ! empty( $selected_sidebar[0] ) )
generated_dynamic_sidebar();
?>
</aside><!-- end .subnav_cont -->

<div class="page_content_right sub-content">
<?php
get_template_part( 'template-part-page-banner', 'childtheme' );
if ( have_posts() ) : while ( have_posts() ) : the_post();
the_content();
truethemes_link_pages();
endwhile; endif;
comments_template( '/page-comments.php', true );
get_template_part( 'template-part-inline-editing', 'childtheme' );
?>
</div><!-- end .page_content_right -->
</div><!-- end #main-wrap -->

<?php get_footer(); ?>

Answers (2)

2013-12-19

Balanean Corneliu answers:

To make the same template like the other blog page you need to give us the file from blog theme.


markh comments:

Actually, I want <strong>this</strong> page-template (left-nav) to list the blog category. I can have it look exactly like the blog theme by simply adding "category" to the menu.

I thought it was just a matter of changing the loop in this section of the code above: <div class="page_content_right sub-content">

<?php

get_template_part( 'template-part-page-banner', 'childtheme' );

if ( have_posts() ) : while ( have_posts() ) : the_post();

the_content();

truethemes_link_pages();

endwhile; endif;

comments_template( '/page-comments.php', true );

get_template_part( 'template-part-inline-editing', 'childtheme' );

?>

</div><!-- end .page_content_right -->


I know there are many parameters available (like whether the full post displays or just an excerpt; if the date displays; comments display... etc, etc.) that's why I included the blog page, to make it easy to see what parameters should be included.

Do you still need to see the other page? (P.S. there is no blog-template, just page.php)


Balanean Corneliu comments:

When you add in the menu that new category if you select the category from Blog/Category list that page need to look like the other blog page.


markh comments:

<blockquote>When you add in the menu that new category if you select the category from Blog/Category list that page need to look like the other blog page.</blockquote>

I have no idea what this means.

<div class="page_content_right sub-content">

<?php

get_template_part( 'template-part-page-banner', 'childtheme' );

if ( have_posts() ) : while ( have_posts() ) : the_post();

the_content();

truethemes_link_pages();

endwhile; endif;

comments_template( '/page-comments.php', true );

get_template_part( 'template-part-inline-editing', 'childtheme' );

?>

</div><!-- end .page_content_right -->


All I want is the appropriate snippet to insert and/or replace to be able to "Show only one category in post list"

I tried this but it didn't work:
<?php query_posts('cat=16'); ?>


Balanean Corneliu comments:

you need the same look of the page for sitename/blog and sitename/blog1 (weare blog and blog1 are 2 diferent category ) right?


markh comments:

No, not right.

I want the page template sited in the first post above ( * Template Name: Left Nav ) to be used as blog#2--which displays only category ID 15.

That's it. Very simple.

2013-12-20

Hariprasad Vijayan answers:

Hello,

Do you want to display posts from category 15 in the same format of Template Name: Left Nav?