March 2020
Beginner
660 pages
18h 28m
English
In step 4 of this recipe, we implemented the widget function. Similar to the form function, we start by retrieving the title and number from the $instance variable. However, we check the values and define a default value for when the options have not been configured by an administrator. Then, we query the wp_posts table by using the WP_Query class. We use the posts_per_page parameter to limit the number of posts using the number field we configured in the widget options. Then, we use the post_status and post_type parameters to get published pages from the database. Finally, we use the meta_key and meta_value parameters to filter a specific page template by using _wp_page_template as the ...
Read now
Unlock full access