WordPress.org

Ready to get started?Download WordPress

Forums

problem with loop.php (3 posts)

  1. nanni85
    Member
    Posted 2 years ago #

    Hi,
    i have a theme installed and when i go to /category/name_of_category show the only 3 post and i dont say why.......
    this is the loop.php

    <?php $theme->hook('loop_before'); ?>
    
            <?php
                $get_post_elements =  $theme->get_option($layout_options_prefix . '_post_elemnts');
    
                if(is_home()) {
                    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
                    $build_homepage_query = array (
        			   'paged'=> $paged,
        			   'category__not_in' => $theme->get_option($layout_options_prefix . '_exclude_categories'),
                       'posts_per_page' => $theme->get_option($layout_options_prefix . '_posts_per_page')
        			);
                    query_posts($build_homepage_query);
                }
    
            ?>
    
            <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    
                    <div class="postwrap clearfix">
            			<div <?php post_class('post clearfix'); ?> id="post-<?php the_ID(); ?>">
                            <?php $theme->hook('post_before'); ?>
    
            				<h2 class="title"><a>" title="<?php printf( esc_attr__( 'Permalink to %s', 'flexithemes' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h2>
    
                            <?php if($theme->display_a('date', $get_post_elements) || $theme->display_a('author', $get_post_elements) || $theme->display_a('comments', $get_post_elements))  { ?>
                            <div class="postdate">
                                <?php
                                    $theme->display_a('date',$get_post_elements,
                                        '<img src="' . get_bloginfo('template_url') . '/images/time.png" alt="" /> ' . get_the_time($theme->get_option('dateformat')) . '   '
                                    );
    
                                    $theme->display_a('author',$get_post_elements,
                                        '<img src="' . get_bloginfo('template_url') . '/images/author.png" alt="" /> ' . get_the_author() . '   '
                                    );
    
                                    if($theme->display_a('comments', $get_post_elements))  {
                                        echo '<img src="' . get_bloginfo('template_url') . '/images/comments.png" alt="" /> '; comments_popup_link( __( 'No comments', 'flexithemes' ), __( '1 Comment', 'flexithemes' ), __( '% Comments', 'flexithemes' ) );
                                    }
                                ?>
                            </div>
                            <?php } ?>
    
                            <div class="entry clearfix">
                                <?php
                                    if($theme->display_a('thumbnail', $get_post_elements) && has_post_thumbnail())  {
                                        the_post_thumbnail(
                                            array($theme->get_option($layout_options_prefix . '_thumbnail_width'), $theme->get_option($layout_options_prefix . '_thumbnail_height')),
                                            array("class" => $theme->get_option($layout_options_prefix . '_thumbnail_position') . " post_thumbnail", 'alt'=>get_the_title(), 'title'=> get_the_title())
                                        );
                                    }
                                    if($theme->get_option($layout_options_prefix . '_content_display') == 'excerpts') {
                                        echo '<p>' . $theme->shorten(get_the_excerpt(),$theme->get_option($layout_options_prefix . '_excerpts_length')) . '</p>';
                                    } else {
                                        the_content('');
                                    }
                                ?>
                			</div>
    
                            <?php if($theme->display_a('categories', $get_post_elements) || $theme->display_a('tags', $get_post_elements))  { ?>
                            <div class="postmeta">
                                <?php
                                    if($theme->display_a('categories', $get_post_elements)) {
                                        _e( 'Posted in:', 'flexithemes' ); ?> <img src="<?php bloginfo('template_url'); ?>/images/cat.png" /> <?php the_category(', '); echo '   ';
                                    }
                                    if($theme->display_a('tags', $get_post_elements)) {
                                        if(get_the_tags()) { ?><img src="<?php bloginfo('template_url'); ?>/images/tags.png" /> <?php the_tags(__( 'Tags:', 'flexithemes') . ' ', ', ', ''); }
                                    }
                                 ?>
                            </div>
                            <?php } ?>
    
                            <?php if($theme->display_a('readmore', $get_post_elements))  { ?>
                            <div class="readmorewrap">
        						<a>" title="<?php printf( esc_attr__( 'Permalink to %s', 'flexithemes' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php _e('Read More »','flexithemes'); ?></a>
        					</div>
                            <?php } ?>
    
                            <?php $theme->hook('post_after'); ?>
            			</div>
                    </div> <!--/post-<?php the_ID(); ?>-->
    
                <?php endwhile; ?>
    
            <?php else : ?>
                <div class="entry">
                    <?php _e('No results were found for the requested archive. Perhaps searching will help find a related post.','flexithemes'); ?>
                </div>
                <div id="searchwrap">
                    <?php get_search_form(); ?>
                </div>
    
            <?php endif; ?>
    
            <?php if (  $wp_query->max_num_pages > 1 ) { ?>
                <div class="navigation clearfix">
        			<?php if(function_exists('wp_pagenavi')) { wp_pagenavi(); } else { ?>
        			<div class="alignleft"><?php next_posts_link( __( '<span>«</span> Older posts', 'flexithemes' ) );?></div>
        			<div class="alignright"><?php previous_posts_link( __( 'Newer posts <span>»</span>', 'flexithemes' ) );?></div>
        			<?php } ?>
        		</div>
            <?php } ?>
    
            <?php if(is_home()) { wp_reset_query(); }?>
    
    Reply
    Message
  2. Jesper van Engelen
    Member
    Posted 2 years ago #

    Have you looked into the parameter that handles this in general for WordPress post queries, "posts_per_page"? I find the parameter in your query arguments around line 10 in your code.

    $build_homepage_query = array(
    	'paged' => $paged,
    	'category__not_in' => $theme->get_option($layout_options_prefix . '_exclude_categories'),
    	'posts_per_page' => $theme->get_option($layout_options_prefix . '_posts_per_page')
    );

    The query argument is set to the contents of a certain option from the theme, which you can probably set in the admin panel under your theme's options. Can you see such an option available in the theme options?

  3. nanni85
    Member
    Posted 2 years ago #

    hi,
    thanks for answer... in theme options i dont see anything about of post_per_page :(

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.