• Please, Im trying to set to 3, the number of displayed posts (Only) in homepage, while keeping 10 or more displayed posts in any of the other category pages, but I can not figure out how to do it with this code… Can you help?

    <?php global $theme; get_header(); ?>
    
        <div id="main-main">
    
            <?php $theme->hook('main_before'); ?>
    
            <div id="content-index">
    
                <?php $theme->hook('content_before'); ?>
    
                <?php
                    $is_post_wrap = 0;
                        if (have_posts()) : while (have_posts()) : the_post();
    
                        /**
                         * The default post formatting from the post.php template file will be used.
                         * If you want to customize the post formatting for your homepage:
                         *
                         *   - Create a new file: post-homepage.php
                         *   - Copy/Paste the content of post.php to post-homepage.php
                         *   - Edit and customize the post-homepage.php file for your needs.
                         *
                         * Learn more about the get_template_part() function: http://codex.wordpress.org/Function_Reference/get_template_part
                         */
    
                        $is_post_wrap++;
                            if($is_post_wrap == '1') {
                                ?><?php
                            }
                            get_template_part('post', 'homepage');
    
                            if($is_post_wrap == '2') {
                                $is_post_wrap = 0;
                                ?><?php
                            }
    
    						if($is_post_wrap == '3') {
                                $is_post_wrap = 0;
                                ?><div class="post-wrap clearfix"><?php
                            }
    
                    endwhile;
    
                    else :
                        get_template_part('post', 'noresults');
                    endif; 
    
                        if($is_post_wrap == '1') {
                            ?><?php
                        } 
    
                    get_template_part('navigation');
                ?>
    
                <?php $theme->hook('content_after'); ?>
    
            </div><!-- #content -->
                        <!--
                         * Aqui deve colocarse o sidebar.
                         * Verificar index-original.php
                         -->
     <div class="entry clearfix">  </div>
        </div><!-- #main -->
    
    <?php get_footer(); ?>
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Do not understand this code’ is closed to new replies.