Displaying multiple content types on the homepage is easy enough, you can just
override the act_display_home method in your theme's theme.php and supply an
array for content_type. I'm sure there's an example on the wiki somewhere, but
it'd be something along the lines of this (totally untested :)):
public function act_display_home( $user_filters = array() ) {
parent::act_display_home( array( 'content_type' => array(
Post::type('entry'), Post::type('works' ) ) );
}
Splitting out the content types for different URLs is more difficult. You'll
need a custom RewriteRule for both /blog and /work, which means you'll need to
do that in a plugin (you can't hook the filter you need in a theme yet). I'm
doing a similar thing in my theme to display the custom archives view, so I'll
just leave you with two relevant links.
First, the plugin that adds the RewriteRule and gets the custom posts is here:
https://github.com/chrismeller/chris-mkii/blob/cwm_companion/cwm_companion.plugin.php
The display_archives RewriteRule causes the act_display_archives method of your
theme to be called when /archives is requested, so you'll want to setup two
RewriteRules - one for /blog and one for /work, each which call their own
method.
You can see how my theme then handles the page here:
https://github.com/chrismeller/chris-mkii/blob/habari/theme.php#L394
You can ignore all the caching stuff, the important part really starts at line
425 where $paramarray is built. The fallback element of the array lists all the
templates to use in descending order of preference. You're displaying posts,
not pages, so it would make more sense for you to use entry.multiple and
works.multiple as the primary template for your two sections, just to keep with
the convention and avoid confusion. You can use the Posts::get() one line 412
pretty much as-is (remove limit entirely to use the global per-page option),
just substitute in your two different content_type values in their respective
methods.
And if you decipher all of that and run into a problem or still have questions,
feel free to ask again, but hopefully this should put you on the right track...
Chris
On Dec 30, 2010, at 6:35 PM, Melee wrote:
> Hey guys!
>
> What I'm attempting to do is display the default content type
> "entries" on the page /blog using page.blog.php and the custom content
> type "works" on the page /work using page.work.php, and display the
> latest work and entry on the home page. I'm not totally sure how to do
> this, even after reading documentation on both themes & content types.
> Can anyone point me in the right direction on how to accomplish this?
>
> --
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/habari-users
--
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/habari-users