Archive page not working…
-
Hi
I’ve set the archive page option for my CPT to true, and I get a page telling me i’ve got X results, but they don’t show in the archive page…
Here’s a link to an exemple page (sory, in French, but you’ll get the idea)
http://continuetaformation.com/?s=illustrator
Furthermore, it shows me the a result (not related, as it is a test post) that shouldn’t be thereAny idea?
Thanks!
-
For what it’s worth, that provided URL is a search results page, not an archive page. Just in case you’re needing it: http://docs.pluginize.com/article/23-post-type-posts-in-search-results
Usually the post type archives url is going to be something like the following, using “illustrator” as an example post type slug. Switch out other post type slugs as appropriate.
http://continuetaformation.com/illustrator/Hi Michael
thanks for the reply. Indeed, I posted a search result page, but I got the same issue with the real archives CPT page : http://continuetaformation.com/formation/ (my cpy is formation)
I’m going to have a look at the page you sent!
RegardsAre you doing any sort of custom querying anywhere? Whether it be in archive.php or something like with a filter attached to pre_get_posts?
Not seeing anything obvious, but we also don’t directly affect frontend queries/templates with the plugin. We just make sure the post types/taxonomies are registered for the use of the user/site owner.
There have been some customization made and I found this in the function page :
add_filter(‘pre_get_posts’, ‘sort_my_archive’);
function sort_my_archive($q) {
if ($q->is_archive) {
$q->set( ‘posts_per_page’, -1 );
$q->set(‘orderby’, ‘post_title’);
$q->set(‘order’, ‘ASC’);
}
return $q;
}Yeah, that would have an effect on things. Are you wanting to have no pagination on all archives? or just specific archive types?
Perhaps something like https://codex.wordpress.org/Function_Reference/is_post_type_archive would help with this. You could limit by post type.
Any changes with this one @brookjacoby?
Hi @tw2113,
Didn’t have the time to work on this one lately,… But I would say that the “no pagination” could be on some specfic page (archive type) in fact!
This would help with conditionally including it, based on post type: https://codex.wordpress.org/Function_Reference/is_post_type_archive
Hi,
From what I see (and understand, as I am no expert into coding), I think the problem might be with the search page ot the theme. Whatever I do, and whatever I search, I keep getting the same results: tells me there is XX search results and only display the standards posts.
When I tried the “Adding all CPTUI post types to the search results.” part of http://docs.pluginize.com/article/23-post-type-posts-in-search-results, I got a fatal error. When I tried the “Adding only some CPTUI post types to the search results.” part, with my cpt, I stil got XX results but no dipslay…
If you do an open search (without any terms : http://continuetaformation.com/?s=), it says that there’s 85 results, but nothing to display…
Not a problem with the plugin, but with the theme I guest 🙂
Thank for your help and sorry for the inconvenience.What was the fatal error that you encountered?
Here :
Fatal error: Call to undefined function cptui_get_post_type_slugs() in /home/ubuntu/workspace/wp-content/themes/continuetaformation/functions.php on line 71 Call Stack: 0.0003 243960 1. {main}() /home/ubuntu/workspace/index.php:0 0.0003 244408 2. require(‘/home/ubuntu/workspace/wp-blog-header.php’) /home/ubuntu/workspace/index.php:17 0.2038 6792112 3. wp() /home/ubuntu/workspace/wp-blog-header.php:14 0.2038 6792328 4. WP->main() /home/ubuntu/workspace/wp-includes/functions.php:886 0.2047 6821320 5. WP->query_posts() /home/ubuntu/workspace/wp-includes/class-wp.php:622 0.2048 6821800 6. WP_Query->query() /home/ubuntu/workspace/wp-includes/class-wp.php:549 0.2048 6830408 7. WP_Query->get_posts() /home/ubuntu/workspace/wp-includes/query.php:3874 0.2050 6843424 8. do_action_ref_array() /home/ubuntu/workspace/wp-includes/query.php:2402 0.2051 6844784 9. call_user_func_array:{/home/ubuntu/workspace/wp-includes/plugin.php:579}() /home/ubuntu/workspace/wp-includes/plugin.php:579 0.2051 6844936 10. my_cptui_add_post_type_to_search() /home/ubuntu/workspace/wp-includes/plugin.php:579The line 7 refer to : $cptui_post_types = cptui_get_post_type_slugs();
FYI: I managed to display the cpt in a search page by creating a new search page… So the problem was the search page!
Hmm. What file/location are you adding the snippet? Just tried it from my theme’s functions.php and it worked just fine.
Also, are you on Custom Post Type UI 1.3.0 or higher? That function wasn’t introduced until version 1.3.0
In the functions.php file. As I said, if I try the code for specific post type, it’s ok.
But, it was with versio 1.1.2! I upgraded and it’s ok!Thanks!
The topic ‘Archive page not working…’ is closed to new replies.