Hammerglass Finland
Hammerglass Finland

Reputation: 27

Wordpress does not print content right

My problem is that for some reason pages title and content prints upside down. And it prints searchbar twice. Can you please take look at coede bwlow

<?php get_header(); ?>

<div class="row">

    <div class="col-xs-12 col-sm-8">

        <div class="row text-center no-margin">

        <?php 
        $currentPage = (get_query_var('paged')) ? get_query_var('paged') : 1;
        $args = array('posts_per_page' => 3,'post_type'=>'post', 'paged' => $currentPage);
        new WP_Query($args);
        if( have_posts() ): $i = 0;

            while( have_posts() ): the_post(); ?>

                <?php 
                    if($i==0): $column = 12; $class = '';
                    elseif($i > 0 && $i <= 2): $column = 6; $class = ' second-row-padding';
                    elseif($i > 2): $column = 4; $class = ' third-row-padding';
                    endif;

                ?>
                    <?php the_content(); ?>

                    <div class="col-xs-<?php echo $column; echo $class; ?> blog-item">
                        <?php if( has_post_thumbnail() ):
                            $urlImg = wp_get_attachment_url( get_post_thumbnail_id( get_the_ID() ) );
                        endif; ?>
                        <div class="blog-element" style="background-image: url(<?php echo $urlImg; ?>);">

                            <!--<?php the_title( sprintf('<h1 class="entry-title"><a href="%s">', esc_url( get_permalink() ) ),'</a></h1>' ); ?> -->
                             <h1 class="entry-title"><?php the_title(); ?></h1>

                            <small><?php the_category(' '); ?></small>
                        </div>
                    </div>

            <?php $i++; endwhile; ?>

            <div class="col-xs-6 text-left">
                <?php next_posts_link('« Older Posts'); ?>
            </div>
            <div class="col-xs-6 text-right">
                <?php previous_posts_link('Newer Posts »'); ?>
            </div>

        <?php endif;
                wp_reset_query();
        ?>
        </div>

    </div>

    <div class="col-xs-12 col-sm-4">
        <?php get_sidebar(); ?>
    </div>

</div>

<?php get_footer(); ?>

Upvotes: 0

Views: 80

Answers (1)

user3084383
user3084383

Reputation: 181

Maybe you were doing the Wordpress101 course in youtube. In the code you show there is not a search bar. The search bar is in the header that you called here using:

Maybe in the header was repeated the calling to the search form:

        <div class="container">
           <?php get_search_form(); ?>
        </div>

Also, I had the problem that bootstrap wasn't rendering in a good way the menu, so I had to add also in the header.php (no matter if I also refer to the bootstrap in the functions.php file , as I assumed you did it in the tutorial) the lines on the Bootstrap CDN in this page: http://blog.getbootstrap.com/2016/07/25/bootstrap-3-3-7-released/

Copy this CDN links:

  • Latest compiled and minified CSS
  • Optional theme
  • Latest compiled and minified JavaScript

Upvotes: 1

Related Questions