![]() | |
| ||||
| Cormac there is an option to have a certain page (rather than post) be displayed on the index.php go to here Cormac Moylan › Login Then you could get the execphp.php plugin to grab the last five posts via the wordpress Codex. I've been doing a fair bit of playing with Wordpress and it's amazing what it can do.
__________________ my sites : irish poker / irish jobs / seo faq / advertise jobs free / green card / skiing |
| ||||
| Hi Paul, I knew that you could set a static homepage using a page but I wasn't aware of the execphp.php plugin. That's the type of thing I'm looking for. Hemingway - Hemingway - Warpspire - has a modified homepage which is kind of similar to what I want to achieve. |
| |||
| I would suggest that you don't necessarily need the execphp plugin. It's handy, but I've found it to be buggy at times, and it can also clash with some of the XHTML correction from the TinyMCE plugin. I would suggest that it might be worth making these kind of alterations within your theme. It gives you more control and you won't bash your head off the keyboard when things aren't working right. On our website I have set the home page as a static page, therefore using the "page.php" file as per the template hierarchy used in Word Press. I wanted to display our most recent portfolio item, and the method done to achieve this is the same as what you are looking for. Here's the code that I've dropped into my page.php template file and I'll break it down below. Code: <?php if (is_page('4')) { ?>
<h1 class="hright">Recent Work</h1>
<?php query_posts('cat=8&show_posts=1&posts_per_page=1'); ?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<div class="post-wrap home-portfolio" id="post-<?php the_ID(); ?>">
<h3 class="post-title"><?php the_title(); ?></h3>
<div class="story-content">
<?php the_content('Continue Reading »'); ?>
<?php link_pages('<p><strong>Pages:</strong> ', '</p>', 'number'); ?>
</div><!-- end post content -->
</div><!-- end post -->
<?php endwhile; endif;
} // end if is_page 4! ?>
In your case, you'll need to start the same if (is_page('x')), which you'll need to follow with 2 or 3 uses of the loop. The first loop use will probably look like: Code: <?php query_posts('show_posts=1&posts_per_page=1'); ?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<h1><?php the_title(); ?></h1>
<?php the_content('Continue Reading »'); ?>
Code: <?php query_posts('show_posts=5&posts_per_page=1'); ?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<h1><?php the_title(); ?></h1>
<?php the_excerpt('Continue Reading »'); ?>
Comments can be a good laugh. I've found that the inbuilt word press comment fetching is a little basic for my HTML structural desires. I've been using the Get Recent Comments plugin to help with this. Dropping the sidebar can be done easily as well using if statements. To give a full picture, here's a condensed version of my page.php file: Code: <?php get_header(); ?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<div id="post-<?php the_ID(); ?>">
<?php the_content(); ?>
</div><!-- end post -->
<?php endwhile; else: ?>
<h2 class="title"><?php _e('Not Found'); ?></h2>
<p><?php _e("Sorry, but the page you're looking for couldn't be found. Double check your URL or you should try searching for it."); ?></p>
<?php endif; ?>
<?php if (is_page('4')) { ?>
<h1 class="hright">Recent Work</h1>
<?php query_posts('cat=8&show_posts=1&posts_per_page=1'); ?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<div id="post-<?php the_ID(); ?>">
<h3 class="post-title"><?php the_title(); ?></h3>
<?php the_content('Continue Reading »'); ?>
</div><!-- end post -->
<?php endwhile; endif;
} // end if is_page 4! ?>
<!-- Begin Sidebar -->
<?php
include(TEMPLATEPATH . '/sidebar-page.php');
?>
<?php get_footer(); ?>
|
| |||
| Aye. There's quite a bit of customisation you can do... The codex is nearly brilliant.. I've spent so much time on there over the last while and it's nearly always sorted me out (with a little help from the forums). Definitely loving the word press thing though. It's fantastic. |
| ||||
| That's a great post Alex, nice tips !
__________________ my sites : irish poker / irish jobs / seo faq / advertise jobs free / green card / skiing |
| Thread Tools | |
| Display Modes | |
|
|
| | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| "No page rank info availible" | lix1 | 8 | 06-03-2008 04:49 PM | |
| Successful Site in 12 Months with Google Alone | montyauto | Webmaster Articles | 11 | 18-02-2008 12:28 PM |
| Crazy irrelevant ads on one page | 404 username not found | Google Adsense | 4 | 12-06-2007 07:53 PM |
| Page Exit / logout | Frodo | Coding Help | 5 | 14-03-2007 12:07 PM |
| Want to front page Digg and Slashdot? Get hacked. | gary.b | Webmaster Discussion | 6 | 17-01-2007 03:31 PM |