SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Member
    Join Date
    Sep 2013
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Problem showing blog posts

    Hi , Ive built a theme up from scratch, and have got the majority of it working , however I've hit a wall getting the blog posts to display?, i thought i had everything ok but it seems not. as im teaching myself , makes things a little harder! so i was wondering if someone could explain to me when writing a theme from scratch , how to get the blog to display , just the standard process what files etc , and i can check what I've done against that and see where I've gone wrong..

    Thanks

  2. #2
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,167
    Mentioned
    453 Post(s)
    Tagged
    8 Thread(s)
    Hi jnrDeveloper. Welcome to the forums.

    I'm not very exerienced at this, but what I've done in the past is open up the default WP theme and compare that code to your own. You can easily see what code is being used to display blog posts.

  3. #3
    SitePoint Member
    Join Date
    Sep 2013
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi ralph, Thanks.

    I managed to figure out what id done wrong by pretty much that method , i reverted back to a theme i knew worked and systematically checked through the pages of code. turns out it was relating to something in index.php!

  4. #4
    SitePoint Enthusiast
    Join Date
    Sep 2013
    Posts
    34
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Hi jnrDeveloper,

    Index,php is often used as default page in WP. Since you are trying to display blog post, your theme (assuming you haven't created any templates) will use index.php, if you however wanted to use a different page template you can do so by adding /* Template Name: Blog Post */ before the header hook on the page.

    You can utilize this feature if you wanted to use different layouts for different pages. Let me know if you have more questions, and I'll help you

  5. #5
    SitePoint Member
    Join Date
    Sep 2013
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi shadir41..

    thanks for your help.. i seem to have that part working now and understand why .. my next question is, when adding a new page via the dashboard in the new theme , it doesn't display , but obviously does in the standard themes , which bits make that work? the navigation is built in the HTML , im gonna need to figure that out too , heh it not easy teaching yourself , you go so far and hit the wall

  6. #6
    SitePoint Enthusiast
    Join Date
    Sep 2013
    Posts
    34
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Ok, here's what you need to know.

    For Pages, WP uses Page.php. Create a new page, copy the index.php inside it and name it page.php.
    Navigation, you should use wp_menu function. Here's the codex http://codex.wordpress.org/Navigation_Menus

    basically you need to enter this on your functions.php
    Code:
    function register_my_menu() {
      register_nav_menu('header-menu',__( 'Header Menu' ));
    }
    add_action( 'init', 'register_my_menu' );
    And add this into your header, where navigation supposed to be
    Code:
    <?php wp_nav_menu( array( 'theme_location' => 'header-menu' ) ); ?>
    create a new navigation on Appearance > Menu

    Remember, when you're stuck look for codex. It's your bestfriend

  7. #7
    SitePoint Member
    Join Date
    Sep 2013
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    that's awesome , thank you!! will keep me busy for the next couple of days ... really appreciate the help .. Thanks!!


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •