Subscribe!
RSS
  • Moshu
  • Prairie
  • WordPress
  • The combined blog: about WordPress, the Canadian Prairies and myself
    The Journey to full time blogging


Static frontpage – combined with dynamic content

[I know I still owe the second part of my Two-level menus article regarding the styling of the menus but today this little trick came up and I thought I'd share it.]

Since WP 2.2.x in the Options > Reading there is the possibility to assign an existent(!) WordPress “static” Page as frontpage of your Wp powered website. Warning: in the same time at the same place you should assign a Page also as “posts page” to display your blog entries, otherwise they will not be visible.
This is a fairly simple operation in the admin panel, so I am wondering why the WP Forum is full of questions re this issue. Normally, any standard WP installation would display as “front page” the index.php of your theme with the usual setup: showing x number of posts, latest on the top.
When we select a Page to be the front page – this action overrides the default WP settings and it is using that WP Page (created in admin > Write > Write Page) instead of the index. Since every decent theme has a template file called page.php, your main or front page will be displayed via that template file.

If you really want to make that first main page special, you can create a special Page template and while creating the new Front Page you can select the newly added template. Till now this is still a relatively simple task, any newbie can follow the instructions to do it. Things might get a bit more complicated if the user wants some “static” Page content and dynamic content combined on the same Front Page. Let’s say, you create your Welcome Page and in the Write > Write Page section you composed your welcome message. After that you select this Page to be your front page. However, in the next step you would like to have the latest five posts’ title or title and excerpt – but only from your “news” category, and displayed underneath the welcome message.

In your favourite text editor (I always use PSPad) open the page.php template file for editing. Save it as main.php – although you can name it whatever you want…
Add this lines at the very top of it:

<?php
/*
Template Name: Main
*/
?>

Now find the last line of the Loop:

<?php endwhile; endif; ?>

(There might be another line after it with the edit_post_link – it this case add the following after that line!)

So, after the lines above we add some code snippet from the Codex, an example for multiple Loops (see the link above).
Let’s say we have a category called “News” and we want to display only the titles of the latest five posts from that category, as a list – under our welcome message.
We need a second Loop for this:

My latest news
<?php $temp_query = $wp_query; ?>
<?php query_posts('category_name=news&showposts=5'); ?>

<?php while (have_posts()) : the_post(); ?>
  <div class="post" id="post-<?php the_ID(); ?>">
	<ul>
           <li><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></li>
        </ul>
  </div>
<?php endwhile; ?>

(Of course, if your category has a different name/slug, you should change that in line #3 accordingly.)

If we want the title and the excerpts (post summary), the method is very similar, just modify the code above, e.g. like this:

My latest news
<?php $temp_query = $wp_query; ?>
<?php query_posts('category_name=news&showposts=5'); ?>

<?php while (have_posts()) : the_post(); ?>
  <div class="post" id="post-<?php the_ID(); ?>">
	<h3><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h3>
	<?php the_excerpt(); ?>		
  </div>
<?php endwhile; ?>

You can have a look at it and/or copy the sample main.php file for the default template from here.

UPDATE. If you don’t need the posts to be filtered by category, just leave out the category_name=news& part of it, and it will show the last X number of posts from any category.

Now, you have a front page with the welcome message at the top (and you can update it any time from the admin panel!), plus your latest news posts on the same page. You can customize that second Loop in any way you wish, using different template tags and div classes or other HTML tags – the limit is only your fantasy and skills.

Update, June 15, 2008. It was brought to my attention that the code presented above has been modified, probably during the move, and had an obsolete “amp;” in it. Corrected.


129 Responses

  • Kyle ·

    Wow, this is way over my head! too technical for me.

  • Dustin Vik ·

    Great Article!!!

  • Johan ·

    This is cool! However, is there not a WYSIWYG that can do most of coding for me?

  • Moshu ·

    No, there is no wyiwyg that would do the coding. Every wysiwyg in the world is for writing content, not for writing code.

  • Spleef ·

    I’m pretty new to this stuff, but this is addressing exactly what I need. BUT…once the main.php is created and saved it along side the other template files in my theme folder, how do I associate it to a page that I create through the admin panel??

  • Spleef ·

    I’m pretty new to this stuff, but this is addressing exactly what I need. BUT…once the main.php is created and I’ve saved it along side the other template files in my theme folder, how do I associate it to a page that I create through the admin panel??

  • Spleef ·

    Sorry…I should say, how do I associate main.php to be my Front Page (using WP 2.2.3)

  • Spleef ·

    Nevermind….found the select Page Template :)

  • Real Estate Investing Blog ·

    This is cool…thanks for the technical explanation. I’d imagine we’ll start seeing new themes with static front page layouts built into them. Blogs are great but there really isn’t a good starting point off the standard home page.

  • Kiran Thomman ·

    I was looking for this for my site. Thanks. However I wanted to use the_content() instead of the_excerpt(). However If the quicktag is used in a post to designate the “cut-off” point for the post to be excerpted, the_content() tag should only show the excerpt up to the quicktag point. However when i tried it here it lists the entire post. Any mods I can try to correct this?

  • April Reign ·

    Thanks so much for this fantastic tutorial!

  • Moshu ·

    Hi April, I’m glad if it was useful. (Oh, in your sidebar the Reuters is mispelled).

  • Moshu ·

    Kiran,
    try to put
    < ?php $more = 0; ?>
    before the query_posts line and see if it works.

  • Amy ·

    Thanks for the article. Very technical though.

  • Eric ·

    I’ve just tried this nice hack, but it modifies ALL pages, not only the “homepage” which combines static welcome message and some of the newests posts…..
    Is there a way to only modify the page template of the “homepage” ?

  • Moshu ·

    So, which template file did you modify, Eric?
    The article says clearly you need a new Page template for it (mine is called ‘main.php’)

  • forex trading online ·

    love this technical stuff, jut wish I could understand it

  • Juunikagetsu ·

    Hey, thanks. Just tried this on my front page. Works fine.

  • noolei ·

    Hi, this tutorial is’nt working for me. I did it like you said but in my main.php (Template for my custom front page) the function the_excerpt shows me the hole posting. don’t know what i did wrong … thx for your help

    btw. in wordpress-forum you said it won’t work for pages, right? what changed your opinion?

  • noolei ·

    so, the $more=0; declaration needs to be after while statement of the lopp. now it works with the_excerpt() …

  • Moshu ·

    noolei,
    about what did I say it wouldn’t work?

  • trading forex online ·

    I was wondering how to do that. Thanks dude

  • Sean ·

    Great tutorial – this type of functionality is probably desired by many people.

    Question – any idea on how to call and display 1 random post from the entire collection of posts, instead of the most recent?

    Again, well done and thanks for the info.

  • Sean ·

    Resolved: I found this plugin code that allows me to add a random=true parameter, so I can do this:
    query_posts(‘showposts=1&random=true’);

    Thanks

  • Sean ·

    Sorry, link didn’t work – here’s the plugin code here

  • Chris ·

    This was very helpful. Thank you!

  • Jack ·

    Worked for me,except none of my links are parsed on my posts…..

  • daniel ·

    Hi,

    I have a front page with static content, and a dynamic listing of all posts. I made it according as per zour instruction.

    However, now I want to display the post excerpts just like they are displayed on a regular category page, so cut off before . I donlt like the way the_excerpt functions.

    Unfortunately though, the_content, which automatically detects if my page is a single post or a post collection, decides that my front page is a single page and subsequently dumps the entire post text of ten posts, which is a wee bit too much.

    How can I instruct the_content only to continue until the tag??

  • Moshu ·

    @Jack,
    I am not sure I understand your question/comment. If you are using the_excerpt in your template file – please read the documentation about it.

    @daniel,
    See my comment above made on November 1st, 2007.

  • Shaun ·

    Thanks for this, solved a problem for me. Have bookmarked your site for future reference too.

    Quick question. How would i go about moving the the dynamic content above the static content? I tried just re-arranging the code but that doesn’t work? Any ideas?

    thanks

  • Joel ·

    Finally I found what I was looking for :-)
    Thank you very much !

    I have 7 categories that I would like to display this way on the same page. I believe that there’s a smarter way to do that than copy/paste 7 times the code :-)

    Each categories I want are sub-categ of another one.
    Does it help ?

    Is there a better way than including your code inside something like:
    foreach (array(cat1, cat2, cat3) as $cat_name) {
    // YOUR_CODE replacing ‘category_name=’
    }

    TIA

  • Moshu ·

    @Shaun,
    When you have 2 loops in the same template, their order might be important. Try to read the Codex about using multiple Loops.

    @Joel,
    I am not sure I understand your question.
    If this is about a Page that is your home/frontpage or some other Page?

  • Joel ·

    @Moshu:

    What I have now : http://test.tumfatig.net/wordpress/
    What I would like :
    - RSS on 3 columns and 2 or 3 lines.
    - Title of the category on top of block.
    - Only the last 3 or 4 items.
    - something like http://www.simplehelp.net/images/rss20/netvibes2.jpg

    I have copy index.php to main.php and added your code example. Then I created a page based on this template and modified “Front page displays” to point to this page.

    My actual code is:

    cat_name; ?>

    <!– <div class=”post” id=”post-”>–>

    <a href=”" rel=”bookmark” title=”Permanent Link to “>

    thanks.

  • Moshu ·

    Joel, what you want has nothing to do with my tutorial.

  • Daan ·

    Perfect, thanks so much!

  • TAWares ·

    Thanks, this article is useful. This helps me to make a portal of my blog.

  • Rahul Joshi ·

    I’ve made a custom teplate for a blog and created a page from that template in wordpress.
    Now when i try to add content into the page, from wordpress, I don’t see anything but when i set the template as default template, i see the content.
    What can be the reason for this?
    Please help me out.

    Thank you

  • Moshu ·

    @Rahul Joshi ,

    Honestly?
    I don’t see how your question is related to the subject of the post above. Or… you were not able to articulate precisely your question. Sorry.

  • Ash ·

    HI, I am working on a new website and wanted my front page static and still have a page for my blog. I followed the instructions at the top of this article. When I go to my “Bog” page I get a 404 Not Found Error. I see that someone else encountered this over in the WP forum, but was not answered…can someone here help me out?

    Thanks!
    Ash

  • Moshu ·

    I am working on a new website and wanted my front page static and still have a page for my blog. I followed the instructions at the top of this article.

    1. What you want is built-in in WP 2.5.x. You should READ in your own admin panel where you set up the frontpage!
    2. For what you want you should NOT use anything from this article.
    3. No, this is not the right place to ask questions unanswered in the Forum. Sorry. And, probably, the other person didn’t get an asnwer because it is a dumb question: the obvious answer is in the admin panel, and every WP user should study it and get familiar with its features.

    Your issue is not related to this article at all. I am willing to help any blogger who is trying to apply the knowledge from my posts – but I do not offer free assistance on my blog for unrelated issues. The forum is the right place to ask general WP support questions.
    If you come here I take it that you want to hire me :)

  • Randy Dandy ·

    I was thinking about using wordpress. is that a good idea?

  • judy ·

    greetings Moshu! Thanks for the code–it’s been great for developing content management in pages. A quick question I hope is easy–I want to reverse the order–posts on top and static content below–but I can’t make it work. Is it possible to do this easily? thanks in advance…

  • Moshu ·

    It has been asked earlier.
    And the answer is still what I replied there: see the Codex for using multiple Loops – without interfering with each other.

  • Mosharaf ·

    Thanks a lot :).

    I managed to come up with almost everything except
    which was messing up my dynamic sidebar. I think you need to add at the end so that your sidebar (in case you have a dynamic one) never gets to know what actually happened in the middle.

    Thanks again.

    Mosharaf

  • Mosharaf ·

    [Sorry for the 2nd post. The 1st one somehow missed the php part :(]

    I managed to come up with almost everything except $temp_query = $wp_query;
    which was messing up my dynamic sidebar.

    I think you need to add $wp_query = $temp_query; at the end so that your sidebar (in case you have a dynamic one) never gets to know what actually happened in the middle.

    Thanks again.

    Mosharaf

  • Havi Brooks ·

    Yay, blog excerpts on the main page! Thank you.

    Question: Is it possible to get this code to work when entered via the WP Page HTML editor?

    I have exec-php so I can run php from a regular WP Page, but I’m not sure I’m tech-ey enough to recreate the css block element (in which I want the excerpts to appear) in the new Page template that you suggest building.

  • sean808080 ·

    this content was perfect for a prototype site i’m building. thanks so much for making it so easy to follow along. i’m a wordpress newbie so i appreciate this a LOT!

    cheers!

  • andrea , italy ·

    hi, maybe it’s a silly question…
    I want to keep my blog front page with multiple articles and at the same time create a page, shown within the ‘pages menu’ that drives to a “main page” of the day/week that only shows the last article written?..
    thank you everybody

  • justin ·

    Ok, so then what about navigation. Lets say I want to show 5 posts from cat 2 beneath the “page” content but I want users to be able to go to the next/older 5 posts?

  • Moshu ·

    justin,
    you can not have the navigation on the frontpage with this combination of Page content and posts.

  • Kajsa ·

    Thanks a lot!!! Your article saved my day.

  • Scott ·

    Is there a way to show all categories but one?
    I’d like to show all posts but not the posts for one particular category.

  • markowe ·

    Since my site is composed largely of static pages would it be possible to do the same thing, but show the last 5 PAGES instead of posts?

  • Moshu ·

    There is no such thing as “last 5 Pages” – because Pages are not part of the chronological stream of the blog entries. I am not saying it is impossible to do it but it would require (probably) some custom coding.

  • Erwin ·

    How can I make this all work with comments? As of now, the whole comment thing doesn’t work outside the index main loop. I have some secondary loops on pages and the comments simply don’t work. Go to http://www.naminanu.com and go to “news” or “executive”. There are two loops and they display the posts but the comments don’t work…

  • Moshu ·

    You are wrong – the comments work where you call them. However, in most themes in the Page template (page.php) the comments template is NOT called: that’s why they are not displayed. This has nothing to do with my tutorial.
    Your problem is that you are not familiar with the Template Hierarchy (see the Codex) and that you edited the index.php and not using the proper template files for other views.

  • Joe Smoe ·

    Your writing style is far too confusing! Learn some tutorial skills please! I would like to understand your teachings.

  • Ron S ·

    Hi Moshu,

    This is an excellent tutorial.

    I similarly wish to show all the latest 5 ‘Articles’ from my articles page just like you’ve mentioned here with excerpts on the home page.

    However, I have a page.php as well as blog_page.php file that shows:

    <?php get_header…


    …..

    Page Not Found
    We’re sorry, but the page you are looking for isn’t here.
    Try searching for the page you are looking for or using the navigation in the header or sidebar

    I added the following code to page.php and created main.php which has been uploaded to my theme folder:

    Web CopyWriters Latest Articles

    <div class=”post” id=”post-”>

    <a href=”" rel=”bookmark”

    title=”Permanent Link to “>

    between and

    In the theme editor the main.php file shows up however, the latest posts don’t show up, why is it so? Have I done this correctly?

    Also, I don’t see any comments section neither the date/posted by for any of my pages as well as blog posts. Is it because I added the main.php file with the steps that you have written here? or is it due to some other issue?

    I really need your help.

    I am wondering why all this is happening Man..

    Moshu, thanks in advance.

    Cool blog.

    Ron

  • Ron S ·

    I get this error when I select the main template for the home page.

    Parse error: syntax error, unexpected T_STRING in /home/content/r/o/n/ronss3/html/webcopywritersblog/wp-content/themes/Notepad-BabyBlue/main.php on line 14

    here’s the main.php file:


    <h1 id=”post-”>


    <?php the_content(‘Read the rest of this entry »’); ?>


    <?php link_pages(‘Pages: ‘, ”, ‘number’); ?>

    Page Not Found
    We’re sorry, but the page you are looking for isn’t here.
    Try searching for the page you are looking for or using the navigation in the header or sidebar

    Web CopyWriters Latest Articles

    <div class=”post” id=”post-”>

    <a href=”" rel=”bookmark” title=”Permanent Link to “>

    Please respond soon. Please.

  • Moshu ·

    Ron S,

    Sorry, I am on a trip, far away from internet and computers. You are doing something wrong. The page.php file is the default Page template and should be done exactly as it is required – not as your think it should be. Copy it from the default theme!
    And read a lot in the Codex about the Page Templates. You can use main.php or anything you wish to name it – just use the right code in it.

  • Brandie King ·

    I used this fix on my site, but now it’s putting a list of posts on every single static page. How can I get the list to only show on the home page?

  • Moshu ·

    Then you are doing it wrong. It is that simple. You skipped the “making a special Page template” step or you are using the same template for every Page of yours.
    Go back and read the post again, until you get it.

  • Brandie King ·

    [On my blog I will moderate/delete any comment that I don't like, especially remarks on my style. - moshu]

  • Brandie King ·

    That’s all fine and dandy, I’ll post it in other places where you’re not able to delete it. You’re full of yourself and aren’t really interested in helping people, you just like to flaunt your knowledge.

  • Moshu ·

    1. You got a detailed tutorial with code and everything. To help you.
    2. In my first post I told you exactly what your mistake was: You skipped the “making a special Page template” step or you are using the same template for every Page of yours. To help you again.

    What else do you want?

  • Brandie King ·

    Honey it wasn’t the information that you provided that was the problem. The problem lies in the way you respond to people.

  • Moshu ·

    Yes, I despise people who are not able to follow a simple tutorial and I treat them accordingly. It is my blog and I respond as I want.
    (further comments about this will be deleted)

  • Arni ·

    Hey Moshu,
    I’ve been trying to get this to work, but can’t. It might be because of my theme. I use a slightly modified metamorph_dna ( http://wordpress.org/extend/themes/metamorph_dna ). I’m not good with code, which is of course why I can’t get your stuff to work. I’ve managed to get the latest news thing on default page, but it shows up on every other page too.

    You tell me to create main.php, which I have done. What exactly should I do with it? Upload it to my blog directory? Or is it a temporary document where I can write the code out and then insert it into page.php?

    My page.php has no – where should I put the new code? I tried sticking it in before the end of the document somewhere, before ““, but that just makes the news thing appear on all my pages.

    I have a feeling, as I said, that it’s my theme that’s causing all this. Can you help me out?

    Thanks a lot!
    Arni

  • Moshu ·

    It might be your theme, although I am not familiar with that theme at all.

    However, if you don’t know what to do with the main .php file – or any other Page template for that matter – then it is most likely you and not your theme.
    Whenever there is a link in my tutorials to an article in the Codex, I assume you went there and have read it all of it, before coming here to ask questions.

  • Mike ·

    Hi Moshu,

    Great article, exactly the info I wanted to know.

    One problem though, the titles of my posts on the main page no longer match, in terms of size and color, the rest of the post titles throughout the site. Any suggestions?

    Thanks,
    M.

  • Mike ·

    Oh, also, I noticed their is no meta data at the bottom of the post. I would like readers to be able to comment right from the home page.

    Thanks,
    M.

  • Moshu ·

    Mike,

    1. They shouldn’t. Edit style.css.

    2. (quote from the post) You can customize that second Loop in any way you wish, using different template tags and div classes or other HTML tags – the limit is only your fantasy and skills.

  • Palatinate11 ·

    Hi Moshu,

    Thanks for your great work. I have the code working so that it shows the last 5 news posts as links/titles in a ul. Great. The only problem is that the rest of each of those posts – all the text shows up below my list of titles. How can I get rid of that and show only the blog post titles on the static page?

    Thanks for your help.

  • Moshu ·

    Most likely, you left the_content tag in the Loop. Delete it.

  • Neil groom ·

    Fantastic tuturial…. Just what I was looking for…. I needed a static front page without the sidebars….. Thank you….

    Found in google after hours of trying it myself….

  • Anthony McGarr ·

    What would I use If I wanted to include the entire post from a category? Or at least a read more button..

    Thanks for the post.. Very helpfull

  • Dash ·

    Thanks for this tutorial Moshu.

    I face a strange issue while trying to show some posts on the front page.

    What I did is:
    I created a page, with its own template.
    In this template, I query some selected posts

    My query is ‘paged’. And I added calls to next_posts_link and previous_posts_link.

    Everything is working perfectly.

    Issue occurs while I try to use this page as my front page. Link generated by the next_posts_link and previous_posts_link are not correct anymore.

    ie: while accessing directly the page : http://mydomain/mypage , links to previous and next entries are : http://mydomain/mypage/page/2, http://mydomain/mypage/3, etc.

    However, while accessing the front page directly : http://mydomain/ links to previous and next entries are now : http://mydomain/page/2 , http://mydomain/page/3 which is not correct.

    I do not see any way to workaround this behavior. Did I make a mistake ? Any idea, comment on this ?

    Thanks ;)

  • Moshu ·

    To be honest, I have never tried to have a “paged” frontpage, so at this moment I have no idea what workaround would work with it. I think, however, when the developers introduced this feature they had in mind only one single Page used as front… and not a “replica” of the index behaviour.

  • Dash ·

    I think you’re right. The issue might be with my original idea ;)

    However, thanks for your time.

  • Lindsey ·

    This is a great tutorial but I cant quite get it to work… I want a section that shows 1 most recent post, I changed my category name in the code, and for it to show only 1 post.. but all that shows on my page/site is the Title. Can anyone help me?

  • rado ·

    hello, is there a sample of this working? thanks.

  • Simon ·

    Great article, got it set up fine.
    Is there a way to get the posts up to the top of the page?

    Thanks Si

  • Moshu ·

    You mean to have the posts on the top AND the welcome message below it?
    It can, probably, done, you just need to experiment with the Loops. (I don’t have time to test it now but when I will have, I’ll post an update to this…)

    Oh, and you can get this tutorial with a few others nicely packed in an ebook, if you go to this Giveaway Event!

  • Simon ·

    Yep that’s what I mean.
    I’ve played with it but can’t get it to work that way round.

    Many thanks, I’ll check back to see if you have had time to have a look.

    Thanks anyway.

  • John ·

    Thanks for the awesome tutorial! I was able to create a nice static front post and now show the actual content for the 5 recent posts

    <div class=”post” id=”post-”>

    <?php the_content(‘Read the rest of this page »’); ?>

  • Kerber ·

    I was wondering if there is a way to post to 2 diferent pages let say (Home) and (articles)
    (Home) is contained of let say 10 post and everything else should go to (articles)

  • Moshu ·

    @Kerber,

    In theory, yes.
    You would need two [2] different Page templates for that: one where the query_posts is limited to 10 posts
    &showposts=10
    and another one with no limitation: delete the code portion above.

  • Federico ·

    Thanks Moshu for your tutorial. Your code helped me to turn some WP blogs into portals, with mimimal effort.
    I was wondering if there is a way to have the ‘query_posts’ based on other than ‘category_name’.
    For example, I would like to have it based on keywords (searching in the post content).

  • Moshu ·

    Everything you need to know is in the Codex: http://codex.wordpress.org/Template_Tags/query_posts

  • Software Toko ·

    Blog like website huh, Very useful information. thanks Moshu

  • marsupial ·

    You rock so hard!

  • Stephano Uno ·

    I was looking for a way to include a few recent posts excerpts on a static home page. This worked really well. Thanks so much!

  • Love ·

    Exactly what I was looking for. Thank you very much!

  • Tim ·

    Thanks. This helped me a lot.

  • JHouse ·

    Awesome!!! I’ve been looking for something like this for probably a couple years now. And to think, it was super easy given your clear and concise instructions. Thank you very much!!!

  • Marguerita Vakas ·

    Thanks for sharing such an insightful article with all of us. I’ve bookmarked your blog will come back for a re-read again. Keep up the great work.

  • Chistes ·

    Thanks for sharing this post, it’s very clear.

  • Kristian ·

    Hey Moshu, thanks for this tutorial, it almost solved my problem.

    Now, I have only one problem before i can head on and deliver my website to my client. Here goes:

    I created an excerpt under my welcome text. It’s working fine, but at the end i get “[...] Continue Reading…”

    My problem is i can’t remove this, and it isn’t a link. I’ve googled for an answer, but can’t seem to find it, so I’m hoping you can help even though this is an old post.

    What i would actually like the link to do, is to link directly to my blog. The blog is used for news, and i’m using the excerpt on the home page to display “recent news”. So after the excerpt I would like a link that says “Go to news”. Is there anyway you can help me?

    My code looks like this:

    <div class=”mainpost” id=”post-”>

    Recent news

    <div class=”post” id=”post-”>
    <a href=”" rel=”bookmark” title=”Permanent Link to “>

  • Kristian ·

    I’ll try again. :)
    My code looks like this:

    <div class=”mainpost” id=”post-”>

    Recent news

    <div class=”post” id=”post-”>
    <a href=”" rel=”bookmark” title=”Permanent Link to “>

  • Moshu ·

    Kristian,

    the answer to your question is in this comment and the following answers…

  • Hussain ·

    Great tips, Thank you!

  • macsnjets ·

    Thanks Moshu, your tutorial worked just fine. I tweaked it to just show the latest post however I can’t figure out how to add the comment box below the one post. I tried within the loop and that doesn’t work. Can you help or send me in the right direction ? I’m far from a php expert.

    Thanks

  • Eero ·

    Thanks, you solved my problem!

  • Sunny ·

    Thanks for this. Solved my problem. Can you please tell me how to add a “read more” link to the end of the posts?

  • Sunny ·

    Ok I figured it out but cannot figure out how to get the “read more” part right next to the end of the excerpt. Right now it is below a skipped line under the excerpt. Here is how I have it now.

    <a href=”" rel=”bookmark” title=”"><a href=”" rel=”bookmark” title=”">Read More

  • Andreas ·

    How can I reduce the space above the header and the posts?

  • Jason ·

    i used this to add posts to my front page, worked great. although images inside the posts do not show up. what would i need to do to fix this?

  • Josh H. ·

    Dear Moshu,

    Please forgive me if I’m missing something, but the excerpt function seems not to be working for me. Here is the exact code I have implemented in the template, but it still only shows links to the blog posts and no excerpts. I hope I am not being wearisome in asking for your thoughts.

    Latest

    <div class=”post” id=”post-”>
    <a href=”" rel=”bookmark” title=”Permanent Link to “>

    Thank you in advance!

    Regards,

    Josh

  • Josh H. ·

    Please disregard my previous comment. For one reason or another, all of my code did not transmit. I will find another route to remedy this, I suppose.

  • Josh H. ·

    Mr. Moshu,

    I was able to work out kinks and this now works beautifully. Thanks so much for imparting this knowledge!

    Sincerely,

    Josh

  • St3ve ·

    Is it also possible to show the posts? I only get links

  • jack ·

    Mr. Moshu

    It’ work.Thank you so much.

    jacktha

  • Derek Miller ·

    I have been working on a complete overhaul of my site using wordpress as my CMS.

    I am completely new to PHP and this simple little thing was frustrating me to no end! Oh, how I wish I would have stumbled on this post a few hours ago…

    Thank you so much, now I can go to bed without raging all night long! :)

  • Jorge ·

    Great post/solution! How can I display the posts in columns instead of a list?

    Thank you for this great solution.

  • Moshu ·

    Jorge,
    You will need to edit either the index.php or create a home.php template file and apply the necessary CSS to it in order to display posts in column.

  • Jevon ·

    Quick question:
    How do you get the static data that you typed into the “Pages” section to show up with the dynamic content? Currently using this method only shows the content that I entered into my created template file. It doesn’t show the data from my page that’s using the template… I’m guessing I did something wrong.

  • Moshu ·

    My guess is you didn’t keep the original loop when editing the template file. Remember, the tutorial says: AFTER the original loop insert the new loop provided by the tutorial above. In plain English – the original loop will display the ‘static’ content and the second loop will display the selected posts.

  • Sam ·

    Hi, This is exactly what I was looking for but I end up banging my head against a wall. I do not seem to get the posts excerpts under the static part. This is my code, what am I doing wrong? Thanks for your help

    …..

    have_posts() ):
    $my_query->the_post();
    endif;
    ?>

    <a href="”>

    have_posts() ):
    $my_other_query->the_post();

    endif;
    ?>

    <a href="”>

    <div class="post" id="post-”>
    <a href="” rel=”bookmark” title=”Permanent Link to “>

11 Trackbacks/Pingbacks

  1. Playing with WordPress » Where is the home of your Home(page)?
  2. Make WordPress Dance to your Tune | Blog Oh Blog
  3. Merrick Virtual Assistant Blog » Blog Archive » Migrate a static website to dynamic blog content?
  4. Bookmarks.WittySparks.com
  5. Loosely SpeakingA Virtual Assistant’s Blog » How to Convert a Static Web Site to a WordPress blog site
  6. NumerousOne - From Many One » Blog Archive » Wordpress Blog Plug-in Selection and Site Organization??
  7. imagesafari blog » WordPress Custom Front Page
  8. Useful wordpress plugins and template tweaks | welcomebrand
  9. Research: Doing a custom frontpage for WordPress « The Struggling Games Developer
  10. Any post type on a static front page « Right The Writer
  11. How to Convert a Static Web Site to a WordPress blog site | Loosely Speaking

RSS feed for comments on this post.   TrackBack URI

Leave a Reply

Do something different
with your WordPress site!

Build SILOS and get in Google's Goodbooks
Here is how to make them LOVING your site:

Silo Manual

GET YOUR FREE REPORT NOW!
(click on the silos!)

Get the free siloing manual
and beat your competition today!




  • Make and save money!
Hassle-free blog setup in minutes   Click here to join Easy Video Producer
RAP Bank   Text Link Ads