I want to customize my homepage simply and easily. I want to create 5 distinct areas on my homepage and be able to drag and drop any post I want into that area to easily replace whatever content is there already.
<?php custom_homepage('easy-as-pie'); ?>
thanks.
James Tryon answers:
Create a custom template for the home page.
<?php
/*
Template Name: Home
*/
?>
To do this take the page.php from your template. resave it. I like to call mine page-"name".php to keep them all in the same place in the theme folder.
Then do what ever you would like in the template.
If you need more help, let me know.
Darren Hoyt answers:
If you link to the jQuery library and then add a region like this to your homepage...
<?php
function get_authors($args = '') {
global $wpdb;
$defaults = array(
'exclude_admin' => true
);
$r = wp_parse_args( $args, $defaults );
extract($r, EXTR_SKIP);
$return = '';
$ex_adm = ($exclude_admin ? "user_login <> 'admin' " : ' 1 = 1');
$hi_emp = ($hide_empty ? "postnum.posts > 0 " : ' 1 = 1');
$query = <<<EOS
SELECT $wpdb->users.*,
COALESCE(postnum.posts,0) as posts FROM $wpdb->users
LEFT JOIN
(SELECT post_author, count(post_author) as posts
FROM $wpdb->posts
WHERE post_type = 'post'
GROUP BY post_author) as postnum
ON $wpdb->users.ID = postnum.post_author
WHERE $ex_adm AND $hi_emp
ORDER BY display_name;
EOS;
$authors = $wpdb->get_results($query);
return $authors;
}
}
...that would work.
rodrigoart answers:
you can meke five loops in home, one per category, and put has stiky the post you want to show in home.
James Tryon answers:
I forgot Once you save the template uploaqde it to the server. FTP SVN SSH GIT what ever you pick, then go to page then edit. Once your in the page on the left side you will see a template drop down. Pick the template that you names in the creation of page-home.php it would be listed as home in the drop down.
FYI if you names a page as home.php it will defoult to the blog home page. Thats why i call them page-"name".php .
Again im happy to help, if there is more you need help with - let me know ;c)
Robert Gordon answers:
This may or may not answer your question but this is a dead simple way to do what you are asking. If you want to eliminate cracking open WP and custom coding then this solution may work for you. You can create 5 dynamic sidebars and position them where you please on the homepage, then you can use the custom query posts widget in the plugin codex to create custom query posts and stick that widget where you want, this will allow you to move around sets of posts based on criteria such as only from the featured category or only from the latest posts based on date.
Alternatively if you do not wish to use a plugin you can create the loops yourself and put them in text widgets with the use of the exec-php plugin to execute the php in the widgets and then drag them around as you see fit. Dragging and dropping any post you want isn't the easiest thing to do and if you don't really know how to do it then you'll need to find an expert charging consultant rates to program it for you, otherwise the solution I outlined above is very reasonable.