ironfish2
Forum Replies Created
-
Forum: Developing with WordPress
In reply to: WP_Query post_type not workingYou are right.
I am using a 3rd party wp.org repository plugin that 1) adds categories and tags to pages, and 2) enables pages to be displayed along with posts in the archive pages.
The code it uses for part 2 is:
if ( ! is_admin() ) { add_action( 'pre_get_posts', 'category_and_tag_archives' ); } // Add Page as a post_type in the archive.php and tag.php function category_and_tag_archives( $wp_query ) { $my_post_array = array('post','page'); if ( $wp_query->get( 'category_name' ) || $wp_query->get( 'cat' ) ) $wp_query->set( 'post_type', $my_post_array ); if ( $wp_query->get( 'tag' ) ) $wp_query->set( 'post_type', $my_post_array ); }
Is this plugin applying the query modification too broadly? (I am not a developer and have no idea LOL)
Then when I use:
$the_query = new WP_Query( array( ‘cat’ => $categoryid, ‘post_type’ => ‘page’ ) );
It returns both posts and pages.
Could I just use
add_action( 'pre_get_posts', 'category_and_tag_archives' );
in a similar fashion to set the post types back somehow?
I dont know if pre_get_posts is the right filter or even if I should be using a filter…..
- This reply was modified 8 years, 1 month ago by ironfish2.
- This reply was modified 8 years, 1 month ago by ironfish2.
- This reply was modified 8 years, 1 month ago by ironfish2.
- This reply was modified 8 years, 1 month ago by ironfish2.
- This reply was modified 8 years, 1 month ago by ironfish2.
- This reply was modified 8 years, 1 month ago by ironfish2.
Forum: Plugins
In reply to: [List category posts] post_type not workingPS, I thought I would let you know that the issue is being caused by the “Post Tags and Categories for Pages” plugin:
https://www.ads-software.com/plugins/post-tags-and-categories-for-pages/
It modifies the wp_query.
Forum: Developing with WordPress
In reply to: WP_Query post_type not workingbcworkz:
PS it turns out the plugin that was causing the issue modifies wp_query just as you said, and the plugin has not been updated in 2 years, so maybe it now has some buggy code….
I am very impressed with your level of knowledge and very grateful that you took the time to share your expertise….
- This reply was modified 8 years, 1 month ago by ironfish2.
Forum: Reviews
In reply to: [Code Snippets] ProblemI am sorry to see that the plugin is being badly reviewed when the cause is not the plugin but the user’s code – very not fair to the developer…..
Forum: Plugins
In reply to: [List category posts] post_type not workingHi, I found that this issue was being caused by another plugin. Sorry to have bothered you about this issue.
Forum: Developing with WordPress
In reply to: WP_Query post_type not workingbcworkz:
Thank you soooooo much for all your help!
I went thru each of the steps you suggested and it turned out to be a plugin.
Forum: Developing with WordPress
In reply to: WP_Query post_type not workingPS I am using the above code in a plugin that creates a short-code and then I have the shortcode in a page.
I am wondering if this is “outside the loop” and causing problems for this reason but I am not sure…….
Any help is appreciated.
Forum: Fixing WordPress
In reply to: Create menu by id of pages, not slug of pagesThanks for your help ??
Forum: Plugins
In reply to: [List category posts] post_type not workingHi, OP here, I wrote my own simple plugin to do the same and found I have the same issue with get_posts…..
I had a
 
at the very end of the page, right after a table.
I deleted it and the issue went away.I had a
 
at the very end of the page, right after a table.
I deleted it and the issue went away.I had a
 
at the very end of the page, right after a table.
I deleted it and the issue went away.Sorry to have bothered you by this post…
PS I deactivated the plugin and the issue still occurs. So likely not the plugin.
Same issue, do not have any of the plugins mentioned above…..
Posting my own issue about this…..- This reply was modified 8 years, 1 month ago by ironfish2.
Forum: Plugins
In reply to: [Better Font Awesome] Color iconsHi, I just left a 5 star rating for this plugin because I think it is great.
Please consider adding (if possible) a shortcode parameter eg called color that allows setting the color without needing to add eg .fa-red {color: red;} to a stylesheet.