[Plugin: Custom Content Type Manager] where are archive pages?
-
Feeling incredibly stupid here… If I have a CCT called “book” should I or should I not expect to find an archive page at http://my.site.com/book ? If it’s not showing up, should I be filing a bug report? And, finally, if I can convince wordpress to call this page into existence, will I be able to add it to the menu using wordpress’s nav_menu system?
Thanks as always, everett!
matthttp://wordpress.org/extend/plugins/custom-content-type-manager/
-
Whether or not a custom content type has archives is configured in its settings: Edit your Content Type definition, then head over to the Advanced tab. See this image:
https://img.skitch.com/20111122-ew7waff6swr38f7s7us3wteq1h.jpg
It could be a bug… I hate the WordPress architecture for this particular thing because it’s really a traffic jam trying to handle the event there — lots of other plugins try to handle the action/filter that alters the Archives behavior.
ah, figured it out — I needed both for the archive option in advanced to be checked, and for the rewrite to be set to /%postname%/ in URL. I was experimenting randomly, not systematically, and hadn’t hit on the right combination. Sorry for the noise!
On the other hand, seeing the results here raises some questions for me:
– if, say , I want to reorder the archives by sorting on custom field, do I do that directly in my template (archive-book/php, in this case)? In that case is the best practice to leave the orderby field unset?
– I realize I probably want a fair bit of text at the top of some of these archive pages, and I probably want the staff to be able to update that text if they want. Should I use summarize_posts instead of WP’s built-in archiving? Can I e.g. display and format a custom field with the summarize_posts shortcodes? Can I use CCTM’s output filters with those shortcodes?
– I may have asked this somewhere already… if I want to filter the archive on a custom taxonomy, is there a built-in way to do that, or will I have to write a half-dozen different templates that differ only in the parameters that are set in the call to get_posts? Seems crazy, but I’m not seeing an obvious wat to do it differently.
Ah, you are slowly seeing the limits of WordPress, and you’ll understand why my support of WP only amounts to “tolerance” and not often to “praise”. MODX handles this sort of customizations *much* more easily.
Yes, the Summarize Posts plugin can be used to help pull this off. CCTM 0.9.5 will integrate the Summarize Posts plugin, and I’ve put in a number of improvements there, but seeing as it’s the holidays and I’m stumped with a couple of the integration points, 0.9.5 won’t be publicly released for a couple more weeks.
You mention that you want a “fair bit of text” at the top of the archive pages: do you mean you need to add changing content to that page? That’s difficult because it’s a dynamically generated page, so that would land you in customization-land because WordPress doesn’t let you manage content inside the archive.php page(s)… you can only edit the template and it’s HTML directly.
So here’s what you could do as a work-around: create a dedicated page for displaying archives. That way you can edit the content of that page in the manager just like any other page or post. You can put the code in that page’s template that pulls up the requested year and month, but in order for that to work, you’d have to basically re-write the code that generates the archive links. It gets complicated quickly because you have to refactor a lot of built-in WP functions (icky).
I have used this plugin before:
http://kwebble.com/blog/2007_08_15/archives_for_a_categoryThat lets you generate archive links filtered on a category, e.g.
<?php wp_get_archives('cat=5'); ?>Hope that helps — there’s not really an easy solution for working around the WP architecture unfortunately.
gnashing teeth. I guess your holidays down there start… already. is there a current dev release that includes some of this summarize_posts stuff? I can do some beta testing if you like, the site still isn’t live (though it’s getting a bit crazy, this lateness of mine).
I guess I can take a look at that category archives plugin and rewrite it to permit filtering on a custom taxonomy (I imagine it’s pretty straightforward). It’d be nice if there’s a way to generate the variable (cat=5) based on some other criterion (URL?); that way I could use the same template for listing e.g.:
– faculty
– undergrad faculty
– grad faculty
– studentsSince I don’t really understand what wordpress knows about the posts its presenting, or how it decides what to show in the_loop, I’m not quite sure how to solve that part.
thanks again, everett…
You can grab the dev version from http://wordpress.org/extend/plugins/custom-content-type-manager/download/ — it includes the Summarize Posts (so you’ll have to deactivate the standalone Summarize Posts if you happen to have it installed). The dev version is still being worked on, but I’ve got it installed on a couple sites while I develop it. The big thing that’s missing is the image upload — you’d have to upload your images using WP’s Media menu until I get that re-integrated (I’m grumbling about the WP architecture there).
I don’t know if the http://kwebble.com/blog/2007_08_15/archives_for_a_category plugin will search on a custom taxonomy or if it’s restricted only to categories.
Sure, you can read stuff out of the WP url’s, but it’s frustratingly primitive. Check out this article: http://scribu.net/wordpress/wp-pagenavi/right-way-to-use-query_posts.html — It applies to query_posts, but it does show how to use the get_query_var() function to read URL components — you could also write code that extracted URL parameters from
$_SERVER['REQUEST_URI'], but… ick.If you could alter your archive-book.php page to use a Summarize Posts query, then you can sort on custom fields, filtered on taxonomy. The wiki page here http://code.google.com/p/wordpress-summarize-posts/wiki/get_posts documents the inputs, but you might be able to do something like this inside of archive-book.php
<?php // ... some stuff before ... $Q = new GetPostsQuery(); $args = array(); $args['taxonomy'] = 'genre'; // e.g. 'genre' $args['taxonomy_term'] = 'Fiction'; $args['post_type'] = 'book'; $args['orderby'] = 'page_count'; // or any custom field $results = $Q->get_posts($args); foreach ($results as $r) { print '<li><a href="'.$r['guid'].'">'.$r['post_title'].'</a></li>'; } // ... some stuff after ... ?>Something like that. The version of Summarize Posts included in the dev version of CCTM has a lot of bugs fixed and features added to support the CCTM integration and search forms.
Hope that helps, Matt. I’ve been swamped for the holidays, and without internet at my parents’ — slowed things down considerably.
The topic ‘[Plugin: Custom Content Type Manager] where are archive pages?’ is closed to new replies.