• Hello everyone, I’m a new fan of wordpress. I created a my own theme and initially it worked fine. I’ve done the chopping of my static html page and all that jazz. What I am curious about is when I make a new page in wp-admin, yes i can see that page has been made, it showed up on my page as a link which is what I want, the problem is the content of the page, I cannot see it. Even though in my admin page there’s some text which i had put, but in my page it doesn’t show. What do you think guys could be the cause of the problem.

    I have these files on folder on my wp directory:
    header.php
    footer.php
    index.php
    //I don’t have a sidebar

    in my index file i have this code:

    <?php get_header(); ?>
    <div class=”content”>
    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    <?php the_content(); ?>
    <?php endwhile; endif; ?>
    </div><!– end of content class–>
    <?php get_footer(); ?>

    My advanced thanks for those who could help me out. Cheers!

Viewing 1 replies (of 1 total)
  • Hi Theunevitable,

    It’s great you’re starting to build your own theme. I can’t see anything that looks wrong with your code above. Perhaps you could try adding an else statement after the endwhile part, like this:

    <?php get_header(); ?>
    <div class="content">
    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    <?php the_content(); ?>
    <?php endwhile; ?>
    <?php else: ?>
    <p>Sorry, nothing could be found.</p>
    <?php endif; ?>
    </div><!-- end of content class-->
    <?php get_footer(); ?>

    This part of the code kicks in if there’s no content to display. Checking which part of the code is triggered (the if part or the else part) might give you a clue as to what’s going wrong.

    Finally, off topic, I suggest you check out the Underscores starter theme by Automattic to start your own project: you don’t need to use it with a child theme, it has minimal styles and has all the files that you need with some basic code in each page. You can find it here:
    http://underscores.me/

Viewing 1 replies (of 1 total)
  • The topic ‘Custom Theme Problem’ is closed to new replies.