fredhead
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: Custom Content Types and WordPress Default CategoriesOkay, I added the taxonomies line to my $args and deleted the explicit registration of taxonomies code. I then re-tagged my content with the categories (a sign, I assume, that the taxonomies settings is now part of the WP install). Then I reset my permalinks, first to default to confirm the ?cat= worked, then to a non-default permalink.
While the category.php template appears to be called, the custom content type content tagged with the category does not display. As a test, I created posts and tagged them with the categories and those entries display fine. And after adding the taxonomies line to my $args, and resetting permalinks, I added new custom content type content and tagged it but that tagged custom content does not display. It appears the query that generates category archive listings needs to include custom content types. Any ideas how I might make that bit happen?
I appreciate all your help.
Forum: Fixing WordPress
In reply to: Problems With Custom Content Type PaginationHi,
If anyone has time/interest, I’ve posted my default WordPress category question here:
http://wordpress.org/support/topic/custom-content-types-and-wordpress-default-categories
I appreciate any help and enlightenment. Thanks!
Forum: Fixing WordPress
In reply to: Problems With Custom Content Type PaginationThanks again. Since this affects my custom content types, which are defined in my functions.php file, my preference is to include the add_filter code above. If it helps anyone, I’ve automated the query to account for multiple custom content types:
function add_custom_posts_per_page( &$q ) { global $custom_post_types; $custom_post_types = array("article", "document", "faq"); if ( $q->is_archive ) { // any archive if ( in_array ($q->query_vars['post_type'], $custom_post_types) ) { $q->set( 'posts_per_page', 1 ); } } return $q; } add_filter('parse_query', 'add_custom_posts_per_page');I have one final problem to debug, related to categories not displaying, but that’s another post here, in the next hour or tomorrow.
Appreciate all your help!
Forum: Fixing WordPress
In reply to: Problems With Custom Content Type PaginationDamn. How does that work? Is the problem that $paged wasn’t being included in the query somehow? Or adding a query (query_posts conflicted? I’d love to know. At the least, thank you!
Forum: Fixing WordPress
In reply to: Custom Post Type Archive Page IssuesHi,
If you’ve not seen, I’ve posted my pagination question as a separate topic here:
http://wordpress.org/support/topic/problems-with-custom-content-type-pagination
I’ve wasted most of today working through the topic link you posted earlier, trying a vast array of solutions, to no avail. Any ideas would be appreciated if you have time/interest. Thanks.
Forum: Fixing WordPress
In reply to: Problems With Custom Content Type PaginationOne other debugging detail: when I manually change the $paged value in my $args array to 2 or 3, the correct content displays with this URL:
mysite.com/?post_type=faq&paged=1
To me, at least, this suggests the problem is not the query but how WordPress handles the URL, specifically, it works for the one above but not for this one:
mysite.com/?post_type-faq&paged=2
even though the query is fine and uses these values from var_dump():
array(5) { [“post_type”]=> string(10) “faq” [“post_status”]=> string(7) “publish” [“paged”]=> int(3) [“posts_per_page”]=> int(1) [“caller_get_posts”]=> int(1) }
Hope the additional detail helps isolate the problem. Appreciate any help.
Forum: Fixing WordPress
In reply to: Custom Post Type Archive Page IssuesExactly. My hunch is that the default permalinks needs the post_type to be the same as the name registered for the content type. When you use non-default permalinks, that’s when you can use rewrite.
BTW pagination didn’t work straight off so I’ll work on that today and come back if I absolutely can’t figure it out. I appreciate your help!
Forum: Fixing WordPress
In reply to: Custom Post Type Archive Page Issues… and I notice _builtin is added to $args.
What doesn’t work is the underlying problem of pulling the correct template. Default permalinks uses index.php in all cases if I use the content type name registered in functions.php. When I switch to a defined permalink, the /faqs URL pulls from archive-faq.php.
Now that /faqs pulls from the right template, I can add content and see if the /page/2/ pagination works.
Let you know how it goes.
Forum: Fixing WordPress
In reply to: Custom Post Type Archive Page IssuesInteresting. It works with permalinks on but not with the default permalinks. Even better, the URL /faqs now calls the archive-faq.php template. So thank you!
For the record, the rewrite value was the only thing you changed in $args?
Forum: Fixing WordPress
In reply to: Custom Post Type Archive Page IssuesYes. The -typename.php is the archive file.
The problem appears to be changing the slug from the value used to register the content type. Specifically, if I set the rewrite value in $args to ‘faqs’ while the content type is registered as ‘faq’ these problems happen. If I set rewrite to true, WP happily displays the index.php template (still ignoring the archive-faq.php and archive.php templates).
Ideally I want to have the slug and content type name different so that my content types will be custom to the install, not likely to be stepped on by some future WP upgrade or plugin that offers a content type called ‘faq’ or ‘faqs’.
My goal is to come up with an instance of creating a content type that works to add/edit/delete content, display an archive page, and display a detail/single page. Displaying the archive page eludes me.
Appreciate your help.
Forum: Fixing WordPress
In reply to: Custom Post Type Archive Page Issues@keesie I’ve reset permalinks all the time, every test. I also don’t have an FAQ page (I should be so lucky!).
Forum: Fixing WordPress
In reply to: Custom Post Type Archive Page IssuesI have an archive template with the filename including the content type name, with the generic WP calls to header, sidebar, and footer, as well as basic content. No wp_query.
Question: If I call my new content type URL, I should see the basic content, correct? That’s how I would test the right template is being called?
My problem is that doing this generates a 404 page. I want to understand how WP got to that 404 page. By first not obsessing about the wp_query code but instead trying to figure out how to get WP to call the correct template.
Any ideas how to determine the path WP takes to get to the 404 page?
The pastebin code is still valid, above. The register_post_type name is ‘faq’, the URL is /faq, and the archive file is archive-faq.php. None of that appears to work: I get a 404 page all the time.
Appreciate any help debugging this problem.
Update: With permalinks “off” to show the querystring, I set the URL to ?post_type=faq then added “xyz” to my archive-faq.php, archive.php, and index.php files, one by one, to match the template hierarchy WP follows. For some reason, my WP install ignores archive-faq.php and archive.php and only uses the index.php template. That’s the mystery I’m trying to solve, for now: how to get WP to use the archive-faq.php template.
Forum: Fixing WordPress
In reply to: Custom Post Type Archive Page IssuesPart of the mystery solved by reverting permalinks to expose the query string values. The “Older Stories” link goes to a page_id value that is for the page instead of a content type. So the querystring values are:
?page_id=30&paged=2
Any ideas the reason the content type is not passed?
Forum: Fixing WordPress
In reply to: Custom Post Type Archive Page IssuesSorry, keesie, see now that my code was whacked in my original post. Here’s the Pastebin URL:
@csd_images, I think that I’ve tried your approach but will try again. Not finding anything clicking down keesie’s tag list, so far.
Thanks.
Forum: Fixing WordPress
In reply to: Custom Post Type Archive Page IssuesExactly what code do you need to see? My functions.php is nearly a 1,000 lines long and much of it spurious to this situation. Are there specific custom post type functions you need to see? That’s why I posted the register function (so you can see the rewrite value) and the template.
I’ll read the pagination posts you reference. Thank you for that.