Ask your WordPress questions! Pay money and get answers fast! (more info)

Pages or more blogs? WordPress

  • SOLVED

Hi!

I have a question about how to work with pages. For example in the menu, i have book of the month, i want to use pages with pagination, like 12-20 items, the page should feed from the blog..Something like this below for example.. This is my page, http://visualdesignworkshop.com/

<article><!-- START MAIN CONTENT -->

<?php query_posts( array(
'posts_per_page' => 1,
'cat' => 120,
'post_type' => 'post',
'paged' => ( get_query_var('paged') ? get_query_var('paged') : 1 ),
));
?>

<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>

<section>
<?php the_excerpt(); ?>
</section>

<?php endwhile;?>

<?php include (TEMPLATEPATH . '/inc/nav.php' ); ?>
<?php else : ?>

<p>Searching and there isn't there!</p>

<?php endif; ?>

<?php wp_reset_query(); ?>

</article> <!-- END MAIN CONTENT -->


This is an example and all pagination isn't there, but is this a good way to work with pages or not?

Best Regards

Felipe

Answers (2)

2012-11-23

Arnav Joy answers:

you can also create a category "Books of the month" and the create posts of the category then use category.php to show the content with pagination


Arnav Joy comments:

use following code to category.php

<article><!-- START MAIN CONTENT -->





<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>



<section>

<?php the_excerpt(); ?>

</section>



<?php endwhile;?>



<?php include (TEMPLATEPATH . '/inc/nav.php' ); ?>

<?php else : ?>



<p>Searching and there isn't there!</p>



<?php endif; ?>



<?php wp_reset_query(); ?>



</article> <!-- END MAIN CONTENT -->


Veritus comments:

i was thinking of doing something like this but, does this work with all different alternatives? I have a lot of different monthly stuff.. I'm beginner with php so..please keep that in mind :)


Arnav Joy comments:

<blockquote>i was thinking of doing something like this but, does this work with all different alternatives? I have a lot of different monthly stuff.. </blockquote>

what do you mean by "all different alternatives" ? do you mean , beside books you have other things to be shown ?

if yes then yes , you can create category approach for this all will work.


Veritus comments:

yes, exactly..as you see in the menu, there is a lot of different topics..


Arnav Joy comments:

ok try the category approach and let me know if you have any problem

2012-11-23

Francisco Javier Carazo Gil answers:

Yes it should work something like this:

global $query_string;
parse_str( $query_string, $my_query_array );
$paged = ( isset( $my_query_array['paged'] ) && !empty( $my_query_array['paged'] ) ) ? $my_query_array['paged'] : 1;
query_posts('post_type=post&posts_per_page=3&paged='.$paged);


With your parameters.


Veritus comments:

oki, i'll check that out Francisco. It's important that it works with all pages on the menu..except the blog of course