Blog Page Issue

5.74K viewsThemes
0

Im trying to make a blog page
currently the only way to do that now is to make a category and add all posts to it
like here http://demo.anspress.io/askbug/category/blog/

i guess a templete theme for blog page?

1

Hi,

This code works perfect for me.

1. Just create an empty .php file. Paste the below code in it and save it in the templates folder (Also if you are using the askbug theme).

2. Create a new page in your WordPress and select the template you just created.

3. Now you can add this page to your menu if prefered.

I edited the code a bit so it would show the post details and make it clickable.

 

<?php
/**
 * Template Name: Blog Page
 * Template used to display blog page
 *
 * @package ab
 */
get_header(); ?>
	<div class="container">
		<div class="row">
			<div id="content" class="main-content-inner col-sm-12<?php echo is_active_sidebar( 'sidebar-1' ) ? ' col-md-9' : ' col-md-12' ?>">
				<?php query_posts( 'show_posts=20&post_type=post&order=ASC&orderby=date' ); ?>
				<?php while ( have_posts() ) : the_post(); ?>

					<?php get_template_part('content'); ?>

				<?php endwhile; // end of the loop. ?>
			</div><!-- close .*-inner (main-content or sidebar, depending if sidebar is used) -->
			<?php get_sidebar(); ?>
		</div><!-- close .row -->
	</div><!-- close .container -->
<?php get_footer(); ?>

great
how do you limit the excerpt though? it shows the entire post

You can add a read-more tag in your original post. Thats how i do it.
If you want to code it, there is a function called custom_excerpt_length() if im not mistaken.

0

Here use this template for your blog page:

https://gist.github.com/rahularyan/fe5597a1622d7bcdeb0e

i think its something missing in the code

Updated code.

still shows nothing

u can delete this question