1
votes

I created a Wordpress theme with bootstrap 3 using the following instructions:

http://www.creativewebdesign.ro/en/blog/wordpress/create-a-responsive-wordpress-theme-with-bootstrap-3-header-and-footer/

The content isn't displaying on any pages. I'm not sure if there is a problem with the container div:

http://www.dawaf.co.uk/creative-mapping/

The test text doesn't show up when I do view the page source.

index.php

<?php
/**
 * The main template file.
 *
 * This is the most generic template file in a WordPress theme and one of the
 * two required files for a theme (the other being style.css).
 * It is used to display a page when nothing more specific matches a query.
 * For example, it puts together the home page when no home.php file exists.
 *
 * Learn more: http://codex.wordpress.org/Template_Hierarchy
 *
 * @package WordPress
 * @subpackage Wp_Bootstrap
 * @since Wp Bootstrap 1.0
 */

    // Gets header.php
    get_header();

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

<?php the_title(); ?></h1>  
        <div class="entry">
            <?php the_content(); ?>
        </div><!-- entry -->
<?php endwhile; ?>
<?php endif; ?>

    // Gets footer.php
    get_footer(); 
?>

page.php

<?php
/**
 * The main template file.
 *
 * This is the most generic template file in a WordPress theme and one of the
 * two required files for a theme (the other being style.css).
 * It is used to display a page when nothing more specific matches a query.
 * For example, it puts together the home page when no home.php file exists.
 *
 * Learn more: http://codex.wordpress.org/Template_Hierarchy
 *
 * @package WordPress
 * @subpackage Wp_Bootstrap
 * @since Wp Bootstrap 1.0
 */

    // Gets header.php
    get_header();

    // Gets footer.php
    get_footer(); 
?>
2
"It is working correctly" can't be in the same sentence with "content isn't displaying on any pages". - STT LCU
I amended the question - user3050023
There's no content. This is definitely not a Bootstrap issue. You should look in your Wordpress code. - zessx
Maybe you could share your page.php code. - Zentaurus
I think you forgot something in your code or there's something wrong. Could you please show to us that we can help you? - roemel

2 Answers

15
votes

I can't see <?php the_content(); ?> in your code. This is needed to display the content. Here you can see the Wordpress page about the_content. So add <?php the_content(); ?> to your index.php or rather to your page.php file or there where you want to display your content.

EDIT:

You also can look at the other themes in your wordpress folder (twentyten etc.). There you can see how <?php the_content(); ?> is used.

EDIT 2:

I forgot to say this. You have to add this to your file, too:

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

<?php the_title(); ?></h1>  
        <div class="entry">
            <?php the_content(); ?>
        </div><!-- entry -->
<?php endwhile; ?>
<?php endif; ?>

This will check if you got any posts or pages. If yes, it will display it, if no, it won't display anything. Put this to your index.php between <?php get_header(); ?> and <?php get_footer(); ?>.

EDIT 3:

I've seen your edit in your question. And I've seen the error. You opened the <?php tag twice. You can go this way:

<?php
/**
 * The main template file.
 *
 * This is the most generic template file in a WordPress theme and one of the
 * two required files for a theme (the other being style.css).
 * It is used to display a page when nothing more specific matches a query.
 * For example, it puts together the home page when no home.php file exists.
 *
 * Learn more: http://codex.wordpress.org/Template_Hierarchy
 *
 * @package WordPress
 * @subpackage Wp_Bootstrap
 * @since Wp Bootstrap 1.0
 */

    // Gets header.php
    get_header();
?>

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

<?php the_title(); ?></h1>  
        <div class="entry">
            <?php the_content(); ?>
        </div><!-- entry -->
<?php endwhile; ?>
<?php endif; ?>

<?php // Gets footer.php
get_footer(); 
?>

This code should be in your index.php and in your page.php.

0
votes

Use this code in page.php:

<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<?php if ( is_front_page() ) { ?>
     <h2 class="entry-title"><?php the_title(); ?></h2>
<?php } else { ?>
    <h1 class="entry-title"><?php the_title(); ?></h1>
<?php } ?>

     <div class="entry-content">
       <?php the_content(); ?>
      <?php wp_link_pages( array( 'before' => '<div class="page-link">' . __( 'Pages:', 'twentyten' ), 'after' => '</div>' ) ); ?>
    <?php edit_post_link( __( 'Edit', 'twentyten' ), '<span class="edit-link">', '</span>' ); ?>
                </div><!-- .entry-content -->
            </div><!-- #post-## -->
     <?php endwhile; ?>