WordPress.org

Ready to get started?Download WordPress

Forums

[closed] Adding Blog to static page (26 posts)

  1. creativepart
    Member
    Posted 2 years ago #

    I'm trying to make my blog's homepage a combination of static content and a couple of recent block posts. I know that it's supposed to work that way by changing a setting. But when I go to dashboard > settings > reading and select show static page and then select the page for the static setting and then the "posts" dropdown settings there are not any post pages to add. Just pages are listed -- no posts.

    I'm using Twentyten theme.

    Am I missing something?

  2. dragonsjaw
    Member
    Posted 2 years ago #

    You will need to use
    blog home page: static

    You will need to create this home page if you haven't already. ( i call mine front page)
    You will need to add a query posts to the loop on this page:
    This is what I use, you may want to set up what posts are called differently. This only calls one post.

    <?php $temp_query = $wp_query; ?>
    <?php query_posts('showposts=1'); ?>
    <?php while (have_posts()) : the_post(); ?>
    	<div class="post" id="post-<?php the_ID(); ?>">
    	<h4><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h4>
    <?php the_post_thumbnail('front-page-post-thumbnail'); ?>  <?php the_excerpt(); ?>
    	</div>
    <?php endwhile; ?>
    </div>
  3. dragonsjaw
    Member
    Posted 2 years ago #

    also when i said create the page, I meant page template:
    copy and paste your themes page.php into a new file call it (for example) front-page.php
    and add this to the top of the new page template:

    `<?php
    /*
    Template Name: Front Page
    */
    '

    Then you create a wp Page and use this new template for it and call that in as your static page.

  4. creativepart
    Member
    Posted 2 years ago #

    The instructions say I can create a blank page. Then use the setting in "settings>reading" to do this.

    Do I need to create my own page template because of the theme I'm using?

    I tired it the way the WP instructions say to do it and it doesn't work. So, I'll try it your way.

    Thanks for the help.

  5. dragonsjaw
    Member
    Posted 2 years ago #

    You could create a blank page but that wouldn't have the additional query posts code in it to pull the posts you want into your front page.

    I do hope you are using a twentyten child theme??

  6. creativepart
    Member
    Posted 2 years ago #

    You lost me on "child theme" I'm using twentyten. Could you explain the Child Theme part?

  7. esmi
    Forum Moderator
    Posted 2 years ago #

  8. creativepart
    Member
    Posted 2 years ago #

    OK, I created a new php template page from the page.php file of my theme, I added the Template Name to the top of the page and saved it as home-page.php.

    But I'm fuzzy on where you suggest I put that code you posted in your first post. Does that go on my existing static home page? Or does that go in the blank page I created for my static page settings?

    I'm not at all clear where that code goes.

  9. creativepart
    Member
    Posted 2 years ago #

    No I don't believe I'm using a child theme. Just plain old 2010.

  10. creativepart
    Member
    Posted 2 years ago #

    I tried putting the code in your first post in that home-page.php page. And I applied that template to my blank page which I've called "blog." Then in Settings > reading I selected static page and selected the name of my static page and "blog" as my posts page.

    Still nothing. But I'm not at all sure if I'm getting your explanation correctly.

  11. esmi
    Forum Moderator
    Posted 2 years ago #

    Don't edit the Twenty Ten theme. Instead create a child theme for your changes.

  12. creativepart
    Member
    Posted 2 years ago #

    Can either of you tell me why the proscribed method of using a blank page isn't working? Does it not work with my theme? I've tried using other pages for my static page and using the blank "blog" page with the default template. But nothing below the static content shows up.

    Isn't that supposed to be how most folks do this? If so, why wouldn't it work on my blog?

  13. dragonsjaw
    Member
    Posted 2 years ago #

    First up.. as Esmi says Don't edit Twenty Ten use a child theme.
    It sounds like this is a new blog so go make a child theme for it.

    Second:

    Can either of you tell me why the proscribed method of using a blank page isn't working?

    What is it doing?

    A blank static page won't have any posts on it.
    A blank static page is for you to code into it what you want there.

  14. creativepart
    Member
    Posted 2 years ago #

    It's not a totally new blog. It's been up and active for 9 months or so.

    The static content page is http://www.goodbeansandgrains.com/
    And the blog is at: http://www.goodbeansandgrains.com/category/this-is-where-i-post-daily/

    You can see what it's doing when you got to the homepage -- it's not showing the blog posts under the static content.

    I created a blank page name "blog" and here's a link to a screen capture of my settings > reading page:

    http://www.goodbeansandgrains.com/img/settings.png

  15. esmi
    Forum Moderator
    Posted 2 years ago #

    That's because you have configured WordPress to use a static front page rather than a posts page in Settings -> Reading.

  16. creativepart
    Member
    Posted 2 years ago #

    I want the most recent posts to appear under the static page content. That's what this is all about. From what I read in the Codex I thought that this works.

  17. esmi
    Forum Moderator
    Posted 2 years ago #

    No - "static" generally means no posts. If you want static content and your recent posts, I suggest that you switch your front page back to your recent posts in Settings -> Reading and look into editing your theme's index.php template file to incorporate the static content that you want.,

  18. creativepart
    Member
    Posted 2 years ago #

    I thought of doing that first, but got the impression that this was a simply one/two process with the blank page set in the second drop doing of the reading settings.

  19. esmi
    Forum Moderator
    Posted 2 years ago #

    Sorry - no. You cannot achieve what you want without editing at least 1 of your theme's template files.

  20. dragonsjaw
    Member
    Posted 2 years ago #

    I thought you wanted a static front page with just a few posts pulled into it AND a blog page.
    That is what I tried to help you with.

    If you want your post page to simply have some static content at the top, do as Esmi says and add your static content to your themes
    index.php file...
    And because you are not using a child theme, make sure you copy any changes you make (to your harddrive - save the template file) as they may be overwritten in WP updates.

    I have done this before and used loop-index.php
    and added this:

    <?php if ( is_home() ) { ?>
    
    	<div id="intro">
    all your html here
    
    </div>
    <?php } ?>

    just above the Start the loop

  21. creativepart
    Member
    Posted 2 years ago #

    I thought you wanted a static front page with just a few posts pulled into it AND a blog page.

    Yes, that's what I'm saying. That is what I would like. I'd like to have my static content homepage, and the newest block post below the static content. Of course, there would still be the blog we have set up.

    I do like the option you've proposed, as well. Thanks for your help I'm sorry I couldn't decipher your instructions.

  22. dragonsjaw
    Member
    Posted 2 years ago #

    All the direction you need to do this on this thread.
    But here's some help:

    First make a child theme:

    If you haven't made any direct changes to any of the theme files
    you can make a child theme by:

    create a folder called:
    beanstwentyten
    in that folder place a style.css file that says:

    /*
    Theme Name: Beans Twenty Ten
    Description: Child theme of the Twenty Ten theme
    Author:
    Template: twentyten
    */

    @import url("../twentyten/style.css");

    Now upload (ftp) or (Cpanel) this folder to your wp-content/themes directory

    Then go to Appearence -- themes- and activate it

    Now you have a child theme.

    ----------------------------------------
    The directions below can now be carried out in the child theme.

    This is what the front-page.php template could look like with the code to pull your latest (1) blog post to the front.

    http://pastebin.com/nEaTD8ZW

    You will need to adjust the css styles to make it look pretty.

    (You would upload this template to wp-content/themes/beanstwentyten)

    Now you set : Static -- home
    You Create the Home Page in the editor (if you are calling your current static page home page)
    then Open it in the editor and
    change the template from default to the new front-page.php template (on the right sidebar of the edit pane)

    Now you should have a static front that looks just like your current static front with a post link and excerpt below. (you will have to make the css to make it look like you want)

    -------------------------- If you don't make a child theme----
    The big caveat to this is that you never created a child theme and your are editing TwentyTen directly.
    I urge you to take a back up of the theme folder every time you make a change to it.

    (FTP -- download theme folder) After every tweak... all it may all be over written

    hth

  23. creativepart
    Member
    Posted 2 years ago #

    Thank you. I'll give this a try. I appreciate your patience and your help.

  24. bigfatty
    Member
    Posted 1 year ago #

    I'm somewhat new to WordPress and trying to learn some new things. I followed the instructions in this post in order to have my static home page pull posts from my blog. It worked pretty good using the code, but I encountered a few problems. I'm using the Twenty Ten theme.

    1. My custom menu for the top navigation bar disappeared and it appears that WordPress reverted back to the default menu. My original CSS file was imported in the child theme and nothing was changed (no styles were added), so I don't know how this change took place.
    2. The sidebar was pushed down below the posts. In other words, you have to scroll down the first page to find the start of the sidebar.

    Below is the entire code of the new page.php template file I placed in the child theme folder (I used my original page.php file's code and added the first few lines of code provided in this post to the top):

    [Way too much code for here and it was likely corrupted as it was not posted using the code buttons. Please use the pastebin.]

    Additionally, two things I would like to know how to do:
    1. Make the post titles remain as a link, but not look like a linkā€¦just simply look like a bold texted, h3 title.
    2. Have an image appear to the left of the post excerpt and under the title, similar to the actual blog page.

    I deactivated my child theme, but here is the link to the site I am trying to develop:

    http://www.laketahoeweddings.net

    Thank you for any solutions.

    Kenny

  25. bigfatty
    Member
    Posted 1 year ago #

    I realized that there was a missing div tag from the code above;

    <div id="frontpagepostpull">

    This took care of the sidebar from being pushed down, but I still have the other problems listed. Thanks again for any help.

    Kenny

  26. WPyogi
    Volunteer Moderator
    Posted 1 year ago #

    Hi Kenny, Can you please start a new thread -- this one is very old, and actually, your issue is not likely to be the same, even if it seems similar. Also please see the forum rules re: posting code:

    http://codex.wordpress.org/Forum_Welcome#Posting_Code

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.