• Hi,

    I have created a new theme for my CMS site. I created following files:

    index.php
    header.php
    footer.php
    functions.php
    sidebar.php
    Style.css
    /images

    Following is content of my index.php:

    [Code moderated as per the Forum Rules. Please use the pastebin]

    Header and footer shows up fine but there is no content from the_post(). I have checked have_posts() is true.

    Can someone please help me what could be wrong with above implementation. Content shows up fine with other themes but not with my custom theme.

    Thanks
    nk94555

Viewing 7 replies - 1 through 7 (of 7 total)
  • Thread Starter nk94555

    (@nk94555)

    I have read that before I started on theme. As per this at minimum you need
    style.css
    index.php

    and I have these in place, content of index.php also seems fine to me but still content doesn’t show up.

    Thanks
    Neeraj

    If no post content is being displayed, then your Loop must be incorrect or incomplete. Review The_Loop.

    Thread Starter nk94555

    (@nk94555)

    As per that document, basic loop is:
    <?php if (have_posts()) : ?>
    <?php while (have_posts()) : the_post(); ?>
    <!– do stuff … –>
    <?php endwhile; ?>
    <?php endif; ?>

    I don’t have anything in do stuff area in my index.
    I think the_post() should output the post content or I need to do something extra?

    Review The_Loop. You cannot just use <!-- do stuff ... -->.

    Thread Starter nk94555

    (@nk94555)

    Following is my code, I don’t have anything in <!– do stuff area –>

    <?php
      get_header();
    ?>
    <div id="content">
    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    <?php endwhile; else: ?>
    <p>Sorry, no posts matched your criteria.</p>
    <?php endif; ?>
    </div>
    <?php
        get_footer();
    ?>

    Go and have a look at the examples posted on The Loop Codex page. And please stop posting code that is more than 10 lines long.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Content doesn't show in my theme’ is closed to new replies.