=== Plugin Name === Contributors: aryanduntley, dunar21 Plugin Name: WPR General Posts Widget Donate link: http://worldpressrevolution.com/wpr_myplugins/wpr-general-posts-widget/ Plugin URI: http://worldpressrevolution.com/wpr_myplugins/wpr-general-posts-widget/ Author URI: http://worldpressrevolution.com/ Tags: posts widget,recent posts, recent post, recent posts widget, popular posts, popular posts widget, posts sidebar, sidebar post widget, custom post type widget, recent posts custom post type, newest posts, newest posts widget Requires at least: 3.0.1 Tested up to: 4.9.5 Stable tag: 1.3.0 License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html Gives you full control of a post listing widget. == Description == With the general posts widget, you can place a list of posts into your widget areas based on any query parameters available in WP_QUERY. You can generate the latest posts, popular posts (given you have some method of tracking post hits), post types, filter by category or other taxonomy, filter by post meta, etc... If it's available in WP_QUERY it's available to you in the widget. If there are customizations that the interface does not allow for, there are a number of hooks that allow you to edit and control pretty much any part of the widget from adjusting the query to adjusting the output. #### Please Note There is no styling associated with this plugin. If you wish to style the output, assign a class and/or an ID to the widget and style appropriately in your style.css file. > #### Available Hooks > * `add_filter( 'widget_title', 'my_Func'); function my_Func($title){return $title;}` > * `add_filter('wpr_adjust_genposts_query','my_Func', 10, 3); function my_Func( $queryargs, $widgetargs, $instance){return $queryargs}` > `$widgetargs` contains things like `before_widget` and `after_widget`. `$instance` contains the widget params you added in the UI. > * `add_filter('wpr_genposts_titlefilter', 'my_Func', 10, 6); function my_Func($fintitle, $before_title, $title, $after_title, $instance){return $fintitle}` > * `add_filter`('wpr_genposts_listloop', 'my_Func', 10, 5); function my_Func($thisprint, $found_posts, $post, $count, $instance){return $thisprint;} > This filter is within the loop that prints the `
  • 's`. `$thisprint` is the final string containing all the html including the `
  • ` opening and closing tags. This filter will likely be the one used the most. By default, this outputs the featured image (if one exists) and the title. That's all. In order to edit the output of the loop, you would want to edit your my_Func function to something else, utilizing the $post variable which contains all the post information (title, excerpt, content, permalink, ect...). This is up to you to customize however you wish. I'm sure the support area will fill up with questions in regards to outputting the lists in a certain fashion. Most people will not read or understand this that I wrote here and many examples will likely sprout up in the support section, so stay tuned and read through those (unless you are the very first to ask for support) before posting a support question. This plugin is free and support should not be expected. I will have a general support license available at a later time, for all WPR plugins, but for now, don't expect, but be grateful if I do answer. I'm usually good about it though. > * `add_filter('wpr_genposts_addtoend', 'my_Func', 10, 2); function my_Func($readingon, $instance){return $readingon;}` > This filter allows you to customize the read more link that is shown after all the posts are displayed. The final text/html is the `$readingon` variable and the `$instance` provides you with all the widget instance params you supplied in the widget interface. > * `add_filter('wpr_genposts_list_print', 'my_Func', 10, 6); function my_Func($finalprint, $openprint, $toprint, $closeprint, $instance, $wpQuery){return $finalprint;}` > This supplies the final list with the container divs and everything else. `$openprint` contains the opening div with the id and class supplied by the widget interface. It also includes the openieng `