[SOLVED] How to show single post special category on static home page??
I've set up the home/landing page as a static page. Most of what will show on that "Home" will be static "Welcome to our website....etc".
But, in the middle of the page I want to have a "News from the Shop" announcement (might even be in a framed "box"). I thought the "Inline Post" plugin would be the solution, but in order to update what post would show on the page, I would have to go to the Dashboard, edit the page's html, changing the post number contained between the double square brackets "[[post##]]" That's clunky. I want to be able to publish the "news annoucement" as a post, using a special category. The most recent post in that category will show up in the "News" box on the home page. I found this code: by Mr. Balkhis at http://www.balkhis.com/web-designs-r...-in-wordpress/. In the line -- query_posts('showposts=1&cat=3');, the showposts= value sets how many posts will be displayed and cat= value specs which single category the displayed post(s) come from. This sounds like it will work, but I can't figure out where to put it. :o :confused: |
Put the following in index.php, for instance right before <?php get_footer(); ?>
PHP Code:
Replace <?php if ( is_front_page() ) { ?> with <?php if ( is_page() ) { ?> to display on all pages <?php if ( is_page('17') ) { ?> to display on the page with the ID 7 query_posts would be used to modify the main post loop, but that's already being used to display the post (= "Page" page content) on the page. |
Okay! With what you provided I've figured out how to make a single post (and/or parts thereof) in my "Announcements" category appear either right after the header or right before the footer of my static pages. ...but unfortunately it appears on ALL the pages.
How can I just have the "announcements" post display on the home page and NOT on ALL of the other pages? |
Jim,
Provide a link to your blog please. I would like to follow what you are doing with it. Thanks, Michael |
Quote:
is_front_page works from WP 2.5 on, with a static page set as the the homepage, at Site Admin -> Settings -> Reading -> Front page displays -> A static page |
Quote:
Please understand that some day "Shepherd Jim dot com" will be my personal blog. But, right now I'm using it as a WP testbed -- trying stuff out in prep for installation on the real website which is now live and visible to the world. I've attempted on two occasions to create a "local" installation of WP following instructions in the Codex, but both times it got scary and I gave up. -- Maybe Flynn will type us up an easy to follow and understand "how to"? hint hint :o ;) -- So, NOTHING on "Shepherd Jim" is real. I've created great blocks of text/content by copying and pasting, pasting and pasting. http://shepherdjim.com/wp/ |
All times are GMT -6. The time now is 07:36 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.