[Resolved] Filter posts by author
I’ve added the author filter to 1.5rc19. It works according to these parameters: http://codex.wordpress.org/Class_Reference/WP_Query#Author_Parameters .
Let me know if you run into any issues with it.
Thank you for the reply and the addition of author parameters to the module. I can see it there. But, I have another question on the matter, is it possible to obtain the author id from the page url? I guess, I can’t find the way to introduce dynamic arguments into the query. I am trying to use the widget to automatically generate posts for the author on whose page the user is.
I am also wandering if it’s possible to create query pages dynamically. For example $user/test will create a query page for each user. I am very new to wordpress, so if this is impossible please just let me know.
Thank you for you help, it is very appreciated,
Note: This is a second edit to the post since I figured out the ‘private’ pages question.
What you’re describing is a contextual filter. This is on my list, but after exposed filters so it may take me a while to get there.
I think the newest release has a solution you could use for this. It’s not in the UI, but it’s the ability to override the WP_Query args using the shortcode.
Assuming you have the query created and it’s id is 1, and that you can use PHP in your wordpress widgets, you could; create a new Widget that can use php, get the global $post object, place the query shortcode into the widget, and dynamically alter the arguments with php.
Resulting in something like this:
<?php global $post; ?>
[query id="1" args="author=<?php print $post->post_author; ?>"]
Just a thought. If you’re not too familiar with PHP, this might not be the best approach.
- The topic ‘[Resolved] Filter posts by author’ is closed to new replies.