Skip navigation

WordPress Tip: How to Display a Specific Post Anywhere You Want

By Mohsin at Blogging Bits

A few days ago when I made some modifications to my blog’s template and added a featured posts box, I was asked how did I do that. It’s nothing too difficult or technical. All I did was installed the required Plugins, inserted the right code, and did a bit of styling to specify three of my favorite posts as featured.

There are a number of reasons why you might want to display a specific post on a specific part of your blog. You may want to display only one post on your blog homepage but still want to show the latest entries in the sidebar, or you may want to highlight the important posts, just like I did, to drive more visitors to those posts.

The following method gives you complete control over how, where, and which parts of your selected posts are shown.

So, without further ado, let’s do it!

Install required Plugins

Install Get-a-Post and Content Extract WordPress Plugins.

Get-a-Post displays a specific post (or Page) with standard WP template tags, while Content Extract provides PHP functions to provide extended extracts functionality.

You’ll use the combination of both to get a post title and post excerpt to appear wherever you want.

Insert the code

Insert the following code in your template file where you want the post to appear.

<?php get_a_post(31); ?>

Insert your post ID where it says ’31’, but nothing is going to happen right now. You’ll have to insert the title template tag for the post title to appear.

<?php get_a_post(31); ?>
    <h1><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h1>

Now that you have your post’s title showing where you specified, it’s time to let the second Plugin take over.

<?php get_a_post(31); ?>
    <h1><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h1>
    <?php wswwpx_content_extract ( 'Continue reading..', 20, 20 ); ?></div>

The string ‘Continue reading..’ makes up the link that takes you to the full post – which is placed at the end of the extract – so replace it with your own text.

The second parameter ’20’ controls how many words to show before truncating the text, and this is the most interesting part. You can have it display one line, two lines or as many lines as you like. With so much control in your hand, you can make your posts easily fit in the sidebar or any other small area in your template. Plus, just copy the above code, and repeat it to display more posts. Remember to change the post ID so you won’t have the same post repeating many times.

This is it. You can style the whole thing as you like.

Just so you can see how I styled my featured posts box, here is the code.

<div id="featured"><div class="fbox"><?php get_a_post(31); ?>
    <h1><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h1>
    <?php wswwpx_content_extract ( 'Continue reading..', 20, 20 ); ?></div>

(Repeated thrice with different post IDs)

And the CSS.

#featured{
width: 940px;
border-bottom: 1px solid #d4cbb4;
border-top: 3px solid #4a3705;
background: #fffdf6 url(images/featured.jpg) bottom right no-repeat;
margin: 12px 0;
padding-bottom: 8px;
float: left;
font-size: 90%;
}
.fbox{
width: 300px;
float: left;
margin: 8px 0 0 9px;
}
.fbox h1{
font-size: 130%;
}
.fbox a{
color: #823d00;
}

Please don’t use the above CSS code, as it is meant to be used only on my blog.

Side notes

There may be other ways to achieve the same result without using any extra Plugins, so, if you know of such alternative methods, please let me know in the comments.


I am Mohsin from Blogging Bits. I am an aspiring young blogger, and I write about creating successful blogs over at Blogging Bits. Be sure to drop by my place for a drink!

96 Comments

  1. Posted September 8, 2007 at 11:32 am | Permalink

    This is great. What a wonderful way to feature a specific post. Have you found a way to randomize this? The Plugin I was using to feature random past posts is no longer supported and this would be brilliant to randomize to stir up posts from your blog archives and feature them.

    Thank you!

  2. Posted September 8, 2007 at 11:50 am | Permalink

    wow! really it’s working for me….

    Thanks

  3. Posted September 8, 2007 at 12:33 pm | Permalink

    Yep. I side with Lorelle. I want the same thing, randomized and category-based, so I can specify something like ‘display here any of the posts with e.g. both the “pencast” and “featurable” categories’.

  4. Posted September 8, 2007 at 8:09 pm | Permalink

    I am also looking for a way to randomize this, and I am sure this can be done with some simple PHP loop thingy. But I wouldn’t pretend to be a PHP guru, so I don’t promise anything.

    If I figure out a solution, I’ll let you guys know.

  5. Posted September 8, 2007 at 8:12 pm | Permalink

    Good one. I did not know about the get_a_post plugin, I had written my own function on the same lines.

    Incidentally, in one of the projects we used it for a very different reason. The homepage was supposed to be a combination of static text and listing of recent posts. Instead of putting the text directly in the homepage template, we let the author enter the static text in a private WordPress post, and we retrieved the post where the static text was to be displayed. This allowed the author to use the WYSIWYG editor to edit the static content, and we were happy since he would not have to edit the template files 🙂

    We can also use this to centralize a piece of content that repeats across a site into a WordPress private post, and retrieve it wherever we want it.

  6. ashishmohta
    Posted September 10, 2007 at 1:07 am | Permalink

    I had been using it. I re designed my home page recently and this came very hand

  7. Posted September 13, 2007 at 6:54 am | Permalink

    I do it a little differently (see http://blogs.ntugo.com/computers). I have a “Featured” category, then I use the Query_Posts() function. It works great, and it gives you a lot of control.

  8. Posted October 19, 2007 at 1:25 pm | Permalink

    Those looking for random post functionality, I’ve put up something that provides it:

    http://wordpress.pastebin.ca/742771

    A benefit here is the code provides a post loop of sorts, so there’s no need to place the code in your template multiple times (that is, for each post).

  9. Posted October 22, 2007 at 9:45 am | Permalink

    I wrote something to do this without any plugin (because get-a-post made troubles on my admin panel)
    Seems to be okay.

  10. Posted February 21, 2008 at 12:46 am | Permalink

    If its just 1 sticky post then why even install a plugin, just use simple html to add a link to the sidebar or wherever needed and it would be all set to go.

  11. Posted February 21, 2008 at 10:06 am | Permalink

    @ Prashant:

    Simple HTML means editing a Theme template file, a foreign country to millions of WordPress users. When the Theme is upgraded, the HTML is gone and must be replaced. Using a Plugin bypasses those issues.

  12. catch
    Posted April 16, 2008 at 7:24 pm | Permalink

    The plugin looks good, Is there any way to do it manually with hand-coding.

  13. rex
    Posted June 9, 2008 at 9:47 pm | Permalink

    thanks, i was trying to solve this problem on my website but found the solution here. Thanks again.

  14. Thomas
    Posted July 11, 2008 at 12:25 am | Permalink

    This is a great plugin, but i have a question, i want to show a post on my startpage. In which file should i write the code so that it is displayed on the startpage, only on the startpage.

    thanks,…

  15. Posted July 11, 2008 at 3:36 pm | Permalink

    @ Thomas:

    You do not need a Plugin or file. Just go to your Settings Panel and set the “home” or “front” page to be whatever post or Page you would like it to be.

  16. Dharma
    Posted July 31, 2008 at 4:57 pm | Permalink

    This is great, just what i needed for my clients website. Big Thank you!

  17. michael
    Posted August 10, 2008 at 2:45 pm | Permalink

    I have a Page on my site and want to display the most recent post in a category, even though it’s a Page.

    Will this plugin work for me, and how?

    Thank you.

  18. Posted August 10, 2008 at 3:30 pm | Permalink

    @ michael:

    There is a lot of complexity in putting categories on Pages, since they do not act the same as posts. I’ve not heard of a Plugin that can pull Pages into most recent posts, but there may be one. Good luck.

  19. Nils
    Posted November 11, 2008 at 11:55 pm | Permalink

    Awesome! Exactly what i needed. I have noticed however it seems to remove formatting and hyperlinks….. it just ignores any , or ‘s and displays it as a stream of text- any ideas?

  20. Nils
    Posted November 12, 2008 at 5:01 pm | Permalink

    I figured it out

    i just used a php “the_content” insert…. obviously the content_extract only extracts text, without formatting….

    thanks for heading me on the right path, all great now!

  21. Posted November 13, 2008 at 12:40 am | Permalink

    @ Nils:

    Ah, now I understand what you are looking for. Just for clarification, it’s the_excerpt that strips all the code for displaying excerpts on the front page and multi-post pageviews on WordPress blogs. Changing it to the_content puts the WHOLE post on the multi-post pageviews, which you may not want, though you can control the length by using the “more” button/tag.

    The excerpt template tag is used for a very good reason on multi-post pageviews. It keeps images and code that can mess up the design on those types of pages from screwing things up. People click through to the whole post to see everything. I recommend that you change it only on the front page but leave the_excerpt template tag in place for other multi-post pageviews like searches, categories, tags, and archives.

  22. TC
    Posted January 12, 2009 at 3:40 am | Permalink

    This is great, but it seems limit only one specific post to be displayed each time. How we can make it multi-specific post to be displayed in different post? Perhaps control by custom field value to assign the value? any solution?

    • Posted January 12, 2009 at 8:49 am | Permalink

      You want to display many posts in a different post? In the sidebar? Do you need a list, like “Related Posts” in the bottom of the post? Mohsin at Blogging Bits is the author of this tip on my blog, so you can ask him directly on his blog if he doesn’t check in here soon, or ask in the WordPress Support Forums. Until I’m clearer on what you want, it’s hard for me to answer.

  23. TC
    Posted January 12, 2009 at 9:27 am | Permalink

    I mean I want to get a specific post to display on certain post only.

    Let say i want to display an old post ‘x1’ at the head of post ‘A’, post ‘B’ and Post ‘C’, but in the meantime i also want to display another old post ‘x2’ in the head of post ‘D’ and Post ‘E’. As you see, if ‘x1’ posted ,then post ‘D’ and ‘E’ are unable to display post ‘x2’ at their head, except I create another template for post ‘D’ and ‘E’…you get what i mean?( sorry of my poor English)

    All I need is let the $id in get_a_Post($1d) varies with the new post. So the ‘x1’ will be display in post A,B and C, and post D and E will only display ‘x2’.

    Is it possible to make the $id customizable by using the custom field value?

    Hope You will understand what i trying to express.

    Thanks.

    • Posted January 13, 2009 at 11:58 am | Permalink

      I’m still traveling and don’t have a lot of time to dig into this, so I recommend you ask on the WordPress Support Forums. You can link to any post on any page, directing people there by your link recommendation in many ways, but this sounds like you want to mix and match your post content on pages, which sounds very much like a spam blog technique.

      So for now, this is my feeling on this issue. If you want to recommend a past blog post, link to it and tell your readers why. Use a Related Posts WordPress Plugin.

      If you would like to showcase a past post in a “featured post” area on your blog post area or in the sidebar or front page, then use a featured post or “from the archives” style WordPress Plugin.

      If you want to pull in information, like a custom landing page greeting or something (say someone arrives on a blog post in the Dog category on your blog, they would be greeted with something that says “If you would like more information on Dogs, see these posts”) then that is a landing page WordPress Plugin. Or you could use Conditional Tags with information in the WordPress Codex on how to do that.

      I am an advocate of the post content being original, not duplicated. Duplicated content is messy and can get you in trouble. I can’t help you mix and match content on a blog post as that goes against everything I believe in for trust and establishing relationships through blogs. Maybe you’ll find someone in the WordPress Support Forum to help, or maybe I’m not understanding.

  24. philwp
    Posted April 11, 2009 at 9:46 am | Permalink

    Thank you, this is very helpful. I am trying to make this work with the Inline PHP plugin and I keep getting error messages. If you could suggest the right syntax to display a post using Inline PHP, I would appreciate it! Thanks again.

    • Posted April 15, 2009 at 9:32 am | Permalink

      I’m not familiar with that Plugin. Talk to the Plugin author for help and support. Thanks.

  25. kexhi
    Posted April 15, 2009 at 2:23 pm | Permalink

    HI
    can you GET specific author posts, instead of a specific post?

  26. Posted June 19, 2009 at 1:20 am | Permalink

    This is a nice plugin, does it work with the latest WordPress 2.8? Anyway, I will download and give it a try… good for customizing my theme.

  27. Posted June 19, 2009 at 7:49 am | Permalink

    Did you try it? It should work. There are also newer methods of doing this, some of which are listed in the comments.

  28. Posted July 7, 2009 at 7:12 am | Permalink

    My apologies – I’m new to WordPress and I have no idea what to do. Any way I could ask a few questions?

    1 – I want to post an article on a specific page “Research”. You say to post this in the “template file where I want the post to appear”(my post ID is 47:

    <a href="”>

    Where do I find the template file? How do I figure out in the template file where the Research Page is?

    I tried putting your code directly on the Research Page, but that didn’t work…help!

    Thanks so much –

    • Posted July 15, 2009 at 3:49 pm | Permalink

      Create the page, then copy the link (or shortcut in IE language) and put that into the HTML Anchor tag, as shown. This has nothing to do with template files. That’s a different subject.

      If you create a page called “Research” and you have pretty permalinks enabled (names not numbers for post URL addresses), then you create a link to that page and put it anywhere in the HTML (like a sidebar text widget, in a blog post, or in the code of a template file found in your WordPress Theme directory).

      To put it in a post, just create the post and where you want the link to go, use the Visual Editor toolbar to add a link and paste in the copied link (starts with http:) and type in the text and whatever else you need. To put it in a text widget, you just put that link into the anchor text (the a href tag) and it will work if you did the code right.

      That’s it.

  29. Brian Garvin
    Posted July 25, 2009 at 5:44 am | Permalink

    I was able to download and install the plugins okay, but have no idea where I need to install that code, your instructions were way too general. I’m a beginning user. Could you please be more specific as to where to paste this code and in exactly which files?

    • Posted July 26, 2009 at 11:55 am | Permalink

      @Brian: I’m not sure what you are asking. If you are asking how to install the Plugin and made the code work, then follow the instructions in the article. If you are asking about how to put a link into a blog post, please see my reply above.

      The files referenced in the article are the WordPress Theme template files, the files that make up the modular framework of a WordPress blog.

  30. Posted July 25, 2009 at 6:06 pm | Permalink

    Hi and thanks for your help – much appreciated. Unfortunately, I’m used to designing my sites from scratch using notepad and html and have been doing so for years, so I don’t know much of what you’re talking about.

    You say to copy and paste the “Page” URL into the HTML Anchor tag, as shown. Where is that shown? I don’t see that anywhere in the example you’ve detailed above. Also, what do you mean by the HTML Anchor tag?

    You also said “To put it in a post” I’m not sure what the “it” is that you’re referring to – I’m so sorry!

    I’m thinking I should create a page, and let’s call it “Research” right? And then create a post? And then somehow find out what the URL is for the post, and paste that into something called the “visual Editor Toolbar”? And if I do that for each post I want on that page, then if one clicks on the Research tab and goes to that page, they’ll be able to see 1, or 2, or 5 or however many articles I’ve posted on that page – is this correct?

    So I just need to know how to find out the URL for each post. Then find out where the Visual Editor Toolbar is so I can paste the URL in there – is there any way you could explain that to me? Or if this is wrong – show me what I need to do instead?

    Thanks again – my apologies for not understanding, but I’ve never worked with WordPress before.

    Katrina

    • Posted July 26, 2009 at 11:52 am | Permalink

      For tips on how to publish a post or page on WordPress or WordPress.com, see What Do I Do With My New WordPress.com Blog, which answers many of your questions.

      The URL for each post is the address seen in the browser address bar when visiting that page or post, or when you right click and copy the “target” or “shortcut” link when you see the link on a page or in your blog’s sidebar. Just put that into an HTML link (or using the tips in the article I just mentioned) wherever you want it.

      WordPress is really easy. If you have worked with any blog or website, the process of adding a link manually is no different. And using the visual editor, it’s a couple button clicks. Good luck with it. It’s not has hard as you think. 😀

  31. Posted July 26, 2009 at 12:27 pm | Permalink

    Thanks again so much for the effort in trying to help me! Unfortunately, I’m finding WordPress most difficult. The link “What Do I Do With My New WordPress.com Blog” is most informative, but offers no help for my situation, unfortunately.

    I know how to create a Post. I know how to create a Page. I know what an URL is, trust me, and I know how to copy and paste an URL and use html code to create a link. That’s not the issue for me.

    I see where you keep saying to just put the URL “into an HTML link (or using the tips in the article I just mentioned) wherever you want it” — my problem is, how do I do that? So for example, I’ve written a Post called “Here you go”. I want it to show up as a post on the Research Page. How do I do that? I don’t want to LINK to the post from the Research Page. I want people to click on the Research tab, go to that page, and see the post there, and have the ability to comment on it and so on.

    Simply put, I want my posts to go on different pages, depending on the post. That way people can comment on them. So I need a Page that contains article posts, a Page that posts interviews, a Page that posts industry-information, a Page that posts research articles…and they should all be separate pages. As it is, Posts only go on the home page – which is pretty much where I DON’T want them to go!

    I’ll keep searching the net to try and find the answer, thanks! I do appreciate your efforts – apparently my ability to explain what I’m trying to do is not very good!

    Take care – Katrina

    • Posted July 26, 2009 at 4:04 pm | Permalink

      Wow, this has gotten complicated. Let me see if I can make it easy.

      What you are looking for are category pages. It is my understanding that you want a post in two places. This does several very bad things. First, it divides up the conversation. If someone has said something really fascinating and helpful on version 1 of the post, those on version 2 will miss it, and maybe they shouldn’t. It also creates what is known as duplicate content, something “very bad” in the search SEO world, especially if it is on your own site.

      I recommend the following to simplify your life and get your back concentrated on content and not fuss. Here’s how:

      1. Create a category called Research (or whatever) to group all related content together. Make sure all appropriate posts get into that category. That becomes the “page that contains research information” so to speak, using your examples. Create another category for Interviews and that becomes your “page of interviews.”
      2. Put the Research category link (or whatever category link) in any posts you want to have the visitor check out your other Research articles, to encourage them to visit. You can create a visible box to highlight the category or a badge or logo or whatever, or just put it in a sentence. I do this with the badges on many of my blog posts, like those in WordPress Tips, so people know immediately which “category” this post is in, as well as what it is about.
      3. For information on how to customize your Category Pages easily, to make them appear like individual pages, see Category Templates. Basically, just add a few template tags to the category template file and then add the custom information in the Description section of your Categories.

      From there, you can create a page that highlights all your different categories, or a static front page that does the same thing, or whatever you want to do. When you put a post in one of those categories, they are added automatically so people will see them when they click on that category.

      They want to read the post, they can, and leave a comment there, so the comments stay with the posts and you get the same effect as you want, without the duplicate content issues, and so on. I recommend that you set the category.php template file to show only excerpts, so help people scroll quickly down the list of articles to find the specific “research” article they are seeking.

  32. Katrina
    Posted July 26, 2009 at 5:48 pm | Permalink

    Hi again!

    With regard to this: “It is my understanding that you want a post in two places” – actually it’s quite the opposite. I ONLY want a post posted in ONE place! So sorry I gave you that idea.

    So the site would look like this:

    Home Article Page Research Page Interview Page—> Links on top of site

    **Then on the Article Page, there would be 2-5 Posts, showcasing different articles.

    Article One Post: blah, blah, blah.

    Article Two Post: blah, blah, blah.

    Article Three Post: blah, blah, blah.

    After each Article Post, people would be able to Comment.

    **********************************

    **Then on the Research Page, there would be 2-5 Posts, showcasing different articles on research:

    Research One Post: blah, blah, blah.

    Research Two Post: blah, blah, blah.

    After each Research Article Post, people would be able to Comment.

    **********************************

    Does this help explain it better perhaps?

    • Posted July 27, 2009 at 7:01 am | Permalink

      I’m glad that you have found a solution. The WordPress Support Forums are excellent resources for help. I’ve edited your previous post to save comment space, but you did a very great job describing the catgory pages I outlined previous. Good luck with your project.

  33. Katrina
    Posted July 26, 2009 at 5:57 pm | Permalink

    Hi there! I found this and will probably try it — it kinds of sounds like it might solve my issue: http://wordpress.org/support/topic/186960

    This is what I’m wanting to do – hopefully this will work!

  34. Posted September 16, 2009 at 2:16 am | Permalink

    hi,
    i’ve added the following lines to display the first image from the post in the excerpt. I hope this will help someone

    $first_img = ”;
    $output = preg_match_all(‘//i’, $post->post_content, $matches);
    $first_img = $matches [1] [0];

    // no image found display default image instead
    if(empty($first_img)){
    $first_img = “/images/default.jpg”;
    }

    $output = “”.$output;

  35. Posted November 4, 2009 at 8:27 am | Permalink

    Hi I have a website on PHP an I want to add blog on it. I want to show some post on index page of mysite. But I am unable to do so.. Kindly help on this.. Example:- jobs.guardian.co.uk has shown some post on main page…
    Thanxs Sachin

  36. Posted December 25, 2009 at 12:30 am | Permalink

    This is a really helpful post. A lot of people tend to make tutorials that only include the php but adding the CSS as well is very useful especially to beginners. Keep up the good work.

    By the way, this is exactly what I was looking for, thanks.

  37. Posted April 26, 2010 at 3:51 am | Permalink

    go to my website .. you’ll see my latest posts down the side (Aunty Vee’s Blog).. here’s the thing.. I want to feature specific posts here… will the above be of assistance ?

    Will the above also allow me to feature specific posts on my BLOG “Page” or only on the side bar widget/box ?

    The reason I’m asking is that I will have quite a few “latest” blog posts that I do not want to be view-ed by anyone who accesses my website… they will only be viewed by those either with the password or the direct URL.

    I don’t want “latest posts” feature anymore. Only want to “feature” specific posts both on the side bar widget and on the Blog “Page” …..

    • Posted May 3, 2010 at 9:45 pm | Permalink

      In today’s WordPress, if you wish to feature a post at the top of your blog posts on the front page, then you can make them “sticky” and use the “Stick to front” option found on that post’s Edit panel. There are also Plugins and ways of customizing your WordPress Theme to permit specific posts to be found or stay on the front page of your blog. But don’t forget that the most frequent gateway to your site is NOT through the front page but on any page.

      As for posts you do not want viewed, that’s a different issue. Make those private in the Edit Post panel.

      As for sidebar post lists, you can customize those with various WordPress Plugins and Widgets or create your own list in a text box. Lot of possibilities on what you can do.

  38. Posted April 27, 2010 at 6:14 pm | Permalink

    hello Lorelle,

    I arrived here after searching a way to obtain the text of some posts to be used as a quick&dirty set of settings. I don’t remember exactly how, but googling around I finally arrived to what seem to me as the simplest solution(at last if one as a bit of familiarity with sql): querying directly wordpress db using wp classes, described here:

    http://codex.wordpress.org/Function_Reference/wpdb_Class

    for instance, I wanted to get the content by passing the post_name, and not the ID. a very simple functin for this could be:

    function get_post_content_from_post_name($post_name) {

    global $wpdb; // remember to alway globalize $wpdb!

    $ssql = “SELECT post_content FROM wp_posts WHERE post_NAME = ‘” . $post_name . “‘”;

    $post_content = $wpdb->get_var($ssql);

    return $post_content;

    }

    in the wp_posts table post_name is the “nice name” of a post. a post titled, say, “My vacation in UK” would have a post_name like “my-vacation-in-uk”.

    maybe this is not the most efficient way to do things, bt I find very easy to code that way.

    in particular, I had to develop such a solution for a client that was always changing his mind about the order in which some “fixed” linked items should have been displayed on the home page. good, I say, go to the post called “so and so”, and write something like:

    an item;;;link of that item
    anoter item;;;link of that item
    anoter item again;;;link of that item

    and change the rows every time you want.

    then somewhere in index.php I get that post text, I manipulate and explode it and use the result to generate the item list.

    sorry if I sound confused, english is not my mother thongue and it’s very late in the night 🙂

    • Posted May 3, 2010 at 9:34 pm | Permalink

      Okay, you have a couple things going on here and I’m at a conference and don’t have much time to answer. The WordPress Support Forums might be a better solution that what I have to offer.

      If you want to change the permalink “post slug” (title) of a post, just change it to whatever you want in the post slug area of the Edit Post panel when you are writing the post. That’s how most people do it. Maybe I don’t understand what you want there. And WordPress “pretties” and cleans the post title automatically.

      As for the second issue about having some order on how things are displayed, I have no idea what you are describing. Clients are not always right, but always make the item the link and not a “click here” kind of thing. Wish I had more time to get into this and understand it better. Explain it more and maybe I can help you better later. Good Luck with it.

  39. Posted May 5, 2010 at 7:57 am | Permalink

    #48: thanks for your interest Lorelle, but I was not asking help for a problem: I was decribing a solution that worked well for me and that may work for others.

    maybe after your conference you may want to have a look at it, or maybe not: it will continue to work well all the same, thanks.

    sorry if my poor english confused things.

  40. karen
    Posted May 12, 2010 at 9:27 pm | Permalink

    Is this good for NOT displaying article on home page?

    • Posted July 6, 2010 at 10:31 pm | Permalink

      You control the number of posts visible on the front page of your WordPress blog through the Administration Panels settings.

  41. John Caldecott
    Posted May 18, 2010 at 2:49 am | Permalink

    Hi Lorelle. Very informative Blog indeed. I have learned a lot from you – I have a question: Can you have 2 wordpress blogs on the same server? I have one installed and also buddypress but I would like to start another wordpress blog from scratch with my existing host (Hostmonster). I don’t know much about cpanel and databases but I presume I would have to make a new database so there wouldn’t be any conflict – if indeed I could have 2 wordpress blogs running at the same time. And if so how would I go about doing it?
    Sorry if I have inconvenienced you in any way. John Caldecott.

    • Posted July 6, 2010 at 10:00 pm | Permalink

      You can install WordPress many times on a single server – check with your web host first, especially if you are on shared hosting.

  42. enam
    Posted July 10, 2010 at 1:12 am | Permalink

    It is 2010 and it still works…U R ROCK MAN…thanks a lot…..

  43. zac
    Posted July 28, 2010 at 8:57 pm | Permalink

    Yea this is just what I needed. Thanks! I am calling in a bunch of excerpts using this method in the sidebar. I did find that with my template I had to reset the query because it was breaking the_content being pulled in for the main page. Perhaps it is something goofy about how I wrote the template but I added the wp_reset_query(); after each excerpt and it fixed it.

    • Posted July 30, 2010 at 10:59 am | Permalink

      Also look for “asides” when you are seeking Plugins and code that will do this. That’s what those are called.

  44. sharon
    Posted August 13, 2010 at 11:37 am | Permalink

    I would like an image to show in this too but it is seeming to strip them.
    Does anyone know how to display the images shown in the original post when showing it using these tools?

    • Posted August 13, 2010 at 8:46 pm | Permalink

      WordPress automatically removes images from excerpts, which is what you are seeing on your front page. If you want them to appear, there are Plugins that will change the default settings for excerpts in WordPress.

  45. sharon
    Posted August 13, 2010 at 11:39 am | Permalink

    What I meant was that I wanted the post to appear unaltered. This post appears on my homepage in a little box. When the user clicks to read more it just goes to the same post but on a separate page. The images show fine on the blog page but I need images to be included on the homepage box too.

  46. Andrew
    Posted August 24, 2010 at 7:41 am | Permalink

    searched for a good while before finding this and it’s so easy. The silly thing is, we were trying to only show sticky content on the home page and restrict the blogs posted to 1. Well, if you do this you restrict all posts in every category to 1 so not the best solution, whereas this is perfect.

  47. Posted October 15, 2010 at 6:08 am | Permalink

    Hello Lorelle,

    Thanks for this article, I used it for our organization’s web site. Now the problem is that the Get A Post plugin seems to be broken in WP3. I’ve contacted the developer to see if it can be fixed but, in the meantime, would you know of any WP3-compatible alternative?

    Many thanks in advance!

  48. erin
    Posted January 14, 2011 at 10:01 am | Permalink

    I’m adding this code to a widget (samsarin php widget) and I keep getting a parsing error…see home page, bottom right box. Any suggestions about what might be causing this issue?

    Thanks in advance!

    • Posted January 14, 2011 at 11:17 am | Permalink

      Please contact the widget authors or developers for help. I’m unfamiliar with this.

  49. Adrian
    Posted February 17, 2011 at 1:57 pm | Permalink

    Is this plugin still working?>

  50. Posted February 17, 2011 at 2:52 pm | Permalink

    Not sure, as this is a guest blog post. Did you check with the Plugin author?

  51. Margaret Jean Copela
    Posted February 23, 2011 at 8:56 am | Permalink

    Lorelle,
    I read how you don’t recommend setting up category tabs (because of duplicate posts). Would it be possible on the front page to have the featured post at the top and then below it would be posts that are the newest posts of particular categories? For example, below the featured post on the right would always be the newest post categorized as “Education” and on the left would always be the newest post categorized as “Families”?

    Thanks, Margaret

    • Posted February 23, 2011 at 1:09 pm | Permalink

      Tabs? Not sure what you mean by that. Tabs are HTML/CSS talk for navigation elements. Duplicate content comes from WHOLE content, not excerpts, repeated endlessly. Use excerpts and no one cares. So yes, you could do that easily.

  52. mrdayganteng
    Posted March 28, 2011 at 12:36 am | Permalink

    not helping what i want, can i place an ad only at certain category at header

    • Posted March 28, 2011 at 12:27 pm | Permalink

      Using conditional tags in your WordPress Theme, you can put all kinds of things anywhere you want with conditional tags and php includes.

  53. Jessica McCarty
    Posted April 8, 2011 at 1:52 pm | Permalink

    Thank you for sharing! I just started using wordpress a couple of months ago and it is so confusing.

  54. Sad Urdu
    Posted April 9, 2011 at 9:25 am | Permalink

    hey i have searched your site through this keyword. “want to show whole posts in categories” So i want to know that How can i show all the posts in the specific category??

    • Posted April 9, 2011 at 11:16 pm | Permalink

      This is a complicated question to answer. I’ll give it my best.

      1. Check your WordPress Theme to see if they have template pages for category.php. If they do, check if they are using the_excerpt() or content() in the WordPress Loop (see the , the online manual for WordPress Users, for more on what all that is). If they are using the_excerpt(), change it to the other.

      2. If you wish to only have one category showing full posts, and not the rest, edit or create the category.php file and insert within the WordPress Loop a conditional tag statement that basically says, if category X, use the_content(), and if anything else, use the_excerpt.

      3. Know that if you have full posts on your categories that you are at risk of penalties for what is known in SEO talk as “duplicate content,” something that drives Google mad. It means that you have the exact same content that shows up in search results on your front page, single post pageview (the actual entry), and on multiple post pageviews like categories, archives, searches, authors, etc. Do some searching for SEO and duplicate content to learn more about why this is a bad thing.

  55. Posted September 17, 2011 at 1:10 am | Permalink

    Nice post. However I am still looking for a specific solution. I have set of pages say page1, page2,..page10. I would like to randomly or sequentially display them one by one in sidebar for a specific period say 2 minutes and then change to next page. Any help?

    • Posted September 17, 2011 at 11:38 am | Permalink

      You want a widget that will randomly promote your content and flip and change while people are viewing the page – I’m sure there are some but things that move and change on the page while it is being viewed is very unfriendly and not meeting web standards. It’s annoying, too. There are a lot of options for randomly (on page load) viewing post content. Customizable Post Listings is one, there are others.

    • Posted September 18, 2011 at 4:18 am | Permalink

      Thanks Lorelle

      Finally I could make it somewhat the way I wanted. Created few pages. Added their IDs in an array and generating random number to select page. This php program I wrote in Text widget (I installed PHP Text Widget).

      Content of Text widget:

      post_content;
      echo $ptv_content; // Output Content
      ?>

      You may visit example at: http://yourstoryclub.com/
      Right side you will see Text Widget under “Tell it Your Way”. On every new page or post or visit, it changes to new page randomly 🙂

    • Posted September 18, 2011 at 4:22 am | Permalink

      oops, php code content got filtered in previous comment – I guess due to php tag – writing again without tag:

      $ptv_array_max_id = 4;//1 less than number of related pages
      $ptv_page_id_array = array(281, 283, 285, 287, 317);
      $ptv_page_id = $ptv_page_id_array[mt_rand(0,$ptv_array_max_id)];
      $ptv_page_data = get_page( $ptv_page_id );
      $ptv_content = $ptv_page_data->post_content;
      echo $ptv_content; // Output Content

  56. YAUN
    Posted February 5, 2012 at 8:42 pm | Permalink

    As a total newbie and wishing to not to have alphabetical listing of pages on the home page and also desiring excerps of the page content, this method seems to be what I’m after.
    1) Yes, No?
    2) If yes, “Insert the following code in your template file where you want the post to appear.
    ” Assuming page can plug in for post (which I would guess requires the id to be king and get_a_post is just a function name), template file = ??? I searched the WP directory of the install for page names but no joy. I’d assume if one had, say, 8 pages, there would be somewhere an insert of 8 get (page ids). No clue how to do this.
    3) Assume that if 2) gets solved, one simply keeps adding code as you have shown to that first get a post line. Yes? No?
    4) If all the above is a big no, then perhaps you could help with the issue of not having an alphabetical listing of pages on the bottom of the home page but a listing in the order I want (no, I don’t want to do the hokie fix of numbering). In this regard, I have to say the sidebar sort order is relatively worthless. Yes, you can sort the sidebar page listing a couple of different ways but then all you get is two different pages listings: the bottom which is alphabetical and the sidebare with whatever non-alphabetical choice you made.
    Thanks for your help on this and sorry to be so WP dense.
    Regards,
    I.G.

    • Posted February 5, 2012 at 9:24 pm | Permalink

      If I understand you right, you wish to change the order of how Pages (not posts) appear in the menu areas of your WordPress Theme. You can do that through the individual Pages by changing their order.

      I might be misunderstanding your references of “pages” as in WordPress a “Page” is a pseudo static web page that shows About, Contact, and other “static” information that works outside of the timeline. A “post” is blog content that is shown in reverse chronological order. It is a standard and expected by default as most everyone wants the most recent information at the top of the list. There are some WordPress Plugins that will change the order, but this is rarely done as it breaks with standards. If you wish to have “static” information at the top of the post queue, you can make a post “sticky” which will stick it to the top of the “list.” Or consider using the “static” front page option with WordPress and set a Page or post to be the front page and have your posts showcased in the “Blog” area. Not sure what your intention is, so I’m trying to quickly cover all possibilities.

      You also wish to show excerpts. You can automatically set excerpt lengths yourself before you hit Publish on a post. Put the cursor where you want the excerpt to end and press the “more” button on the Post Panel button bar.

      I’m confused with where you wish Posts and Pages to appear as it seems you are talking about them in the content area, then you mention the bottom, which is the footer typically, and the sidebar, so I’m confused.

      I recommend you check out Learn WordPress and the , the online manual for WordPress Users, for more helpful information.

  57. masterwin
    Posted March 15, 2012 at 2:43 am | Permalink

    Hi

    But if we hard code the “post ID”, then once we move the files to live server..we need to change the ID.

    so it will get hard for untechnical users, let me know any ways? with out this ID hard coded?

    • Posted March 15, 2012 at 9:42 am | Permalink

      If you move to a live server after testing, will the post ID change? Maybe, maybe not. Did you test it? How many times will you make such a move? Once? Twenty times? So you change it once when you move and it’s done.

      This involves a WordPress version from 2007. Conditional Tags and queries have improved greatly in WordPress. I recommend you dig into the Codex and apply your desired design goals to the updated information, which might help you bypass the issues of file migration.

  58. kamal
    Posted May 18, 2012 at 5:31 am | Permalink

    Can Anybudy help me in telling in which template file code given in the post have to be pasted..

    • Posted May 20, 2012 at 10:19 am | Permalink

      The article lists specifics. Are you having trouble with creating a Child Theme to add such customization?

  59. Bangla
    Posted May 30, 2012 at 10:53 pm | Permalink

    Sometime we needed to show our details page (that means single.php) in different styles per my example.

    • Posted May 31, 2012 at 11:35 am | Permalink

      Thank you for the alternative method on creating a “single post pageview” alternative – just to use the proper name. 😀

  60. Posted December 27, 2013 at 4:38 am | Permalink

    All My post usually uses various plugin based data manipulations (Like visual layout, grouping, plugin css, etc) And now I want to render a post content in my admin page. On using following code:

    $post = get_post(123);
    $content = apply_filters(‘the_content’, $post->post_content);
    echo $content;

    It just displaying a formated text content and I can’t see my plugin based alignments, layouts which I usually can see it on normal post.

    So How to get post content for admin panel all formatted along with all plugin based manipulation done?

    • Posted December 28, 2013 at 8:31 am | Permalink

      Have you asked in the WordPress Support Forums? I’m not sure what you are trying to do. They will have the time to spend exploring your options and learning more about what you want to accomplish and can be very helpful there. Good luck with it.

  61. Posted September 14, 2016 at 1:02 am | Permalink

    Yay google is my king assisted me to find this great internet site!

  62. Posted September 14, 2016 at 1:13 am | Permalink

    You really make it appear so easy along with your presentation however I to find this topic to be actually one thing
    which I believe I would never understand. It seems too complex and
    extremely vast for me. I’m taking a look ahead to your subsequent publish,
    I’ll try to get the hold of it!

  63. Posted September 14, 2016 at 3:38 am | Permalink

    Definitely believe that which you said. Your favorite reason appeared to be on the web the simplest factor to keep in mind of.
    I say to you, I definitely get irked whilst folks consider concerns that they plainly don’t recognize about.

    You controlled to hit the nail upon the highest and also outlined out
    the whole thing with no need side-effects , other folks
    can take a signal. Will probably be back to get more.
    Thanks

  64. Posted September 14, 2016 at 5:32 am | Permalink

    If some one needs expert view regarding blogging afterward
    i suggest him/her to pay a quick visit this
    blog, Keep up the good work.

  65. Posted September 14, 2016 at 8:31 am | Permalink

    Yay google is my king aided me to find this great website!

  66. Posted September 14, 2016 at 5:16 pm | Permalink

    You really make it appear really easy with your presentation however I in finding
    this matter to be really one thing that I think I’d never understand.
    It seems too complex and extremely huge for me.

    I am looking ahead for your subsequent post, I will try to get the cling of it!

  67. Posted September 15, 2016 at 12:34 am | Permalink

    Glad to be one of several visitors on this awing internet site :D.

  68. Posted September 15, 2016 at 11:46 pm | Permalink

    I read this piece of writing completely regarding the resemblance of latest and earlier technologies, it’s amazing article.


12 Trackbacks/Pingbacks

  1. […] WordPress Tip: How to Display a Specific Post Anywhere You Want: Want to feature a post on your blog anywhere in your WordPress Theme? This tip by Mohsin at Blogging Bits will show you how to do it easily. […]

  2. […] her, she is the Queen of content, the wizard of WordPress one of my personal favorites Lorelle of Lorelle on WordPress. She always has some great information from WordPress News, design, plugins and so much more. If […]

  3. […] WordPress Tip: How to Display a Specific Post Anywhere You Want at Lerelle on WordPress. […]

  4. […] Forum verbinden, und dann auch noch was nettes hier z.B umd z.b die Last Post anzeigen zu lassen. WordPress Tip: How to Display a Specific Post Anywhere You Want Lorelle on WordPress __________________ […]

  5. […] this up so Sumi can adjust the home page without messing with […]

  6. […] WordPress Tip: How to Display a Specific Post Anywhere You Want « Lorelle on WordPress How to display WordPress posts on Pages (tags: blog blogging cms webdesign wordpress plugin) […]

  7. […] have found what looks like a solution here that I need to look at when I have more […]

  8. […] WordPress Tip: How to Display a Specific Post Anywhere You Want: Want to feature a post on your blog anywhere in your WordPress Theme? This tip by Mohsin at Blogging Bits will show you how to do it easily. […]

  9. […] WordPress Tip: How to Display a Specific Post Anywhere You Want: Want to feature a post on your blog anywhere in your WordPress Theme? This tip by Mohsin at Blogging Bits will show you how to do it easily. […]

  10. […] WordPress Tip: How to Display a Specific Post Anywhere You Want: Want to feature a post on your blog anywhere in your WordPress Theme? This tip by Mohsin at Blogging Bits will show you how to do it easily. […]

  11. […] WordPress Tip: How to Display a Specific Post Anywhere You Want […]

  12. […] 自:wordpress tip how to display a specific post anywhere you want […]

Post a Comment

Required fields are marked *
*
*