Use the sample question below as a guide to solve the 5 questions.
Good Luck !!!
Question: Write out the array for a custom query function ($args) that will show posts only from a category named ‘shop’.
Solution: $args = array (
‘category_name’ => ‘shop’
);
- Write out the array for a custom query function ($args) that will show posts only from a category named ‘News’ and that have a tag called ‘Batman’.
- Write out the array for a custom query function ($args) that will show posts only from authors with the following ids ‘1, 14, 15, 28, 33’.
- Write out the array for a custom query function ($args) that will show posts from all categories with the exception of a category with an id ‘18’.
- Write out the array for a custom query function ($args) that will only show 3 random posts that are password protected.
- Write out the array for a custom query function ($args) that will show posts from a post type called ‘actors’ while skipping the first 2 most recent posts.