WPR General Posts

WPR General Posts

Wordpress plugin

Install on Wordpress

App Details

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 <li>'s. $thisprint is the final string containing all the html including the <li> 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 <ul> tag. $closeprint contains all the closure tags for the $openprint as well as the readmore link/text. $toprint contains everything in between (the result of the query contained in <li> tags). $wpQuery contains the WP_Query instance, which can be used for pagination or anything else where the data provided could be useful. To add pagination, something like this would work:
    function homeAddPages($finalprint, $openprint, $toprint, $closeprint, $instance, $postsQ){
    $big = 999999999;
    $cpage = get_query_var('paged')?get_query_var('paged'):0;
    if(!isset($cpage) || $cpage == "" || $cpage === 0){
    $cpage = get_query_var('page')?get_query_var('page'):1;
    }
    $addclose = paginate_links( array(
    'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
    'format' => '?paged=%#%',
    'current' => max( 1, $cpage),
    'total' => $postsQ->max_num_pages
    ) );
    return $openprint . $toprint . $closeprint . '<div class="hpaginator">' . $addclose . '</div>';
    }
    add_filter('wpr_genposts_list_print', 'homeAddPages', 10, 6);
  • add_filter('wpr_adjust_genposts_beforewidget', 'my_Func', 10, 3); function my_Func($before_widget, $post_widgeid, $post_widgeclass){return $before_widget;}
    This allows you to modify the before widget string which contains the wrapper div with id and class. You have access to the ID and Class you defined within the widget in order to tell instances apart from each other.
    unction wpr_changeBeforeWidget($before_widget, $post_widgeid, $post_widgeclass){
    if($post_widgeid == 'theothers'){
    return str_replace('class="', 'class="theothersblock ', $before_widget);
    }
    if($post_widgeid == 'thefeatured'){
    return str_replace('class="', 'class="thefeaturedblock ', $before_widget);
    }
    return $before_widget;
    }
    add_filter('wpr_adjust_genposts_beforewidget', 'wpr_changeBeforeWidget', 10, 3);
  • add_filter('wpr_adjust_genposts_afterwidget', 'my_Func', 10, 3); function my_Func($after_widget, $post_widgeid, $post_widgeclass){return $after_widget;}
    This is identical to the wpr_adjust_genposts_beforewidget hook except this one allows you to modify the after widget string. These last two allow you direct control over each individual widget container. These before and after strings are set in the register_sidebar function when creating the sidebars, but they are generic for all widgets in that sidebar and WP does not offer any hooks to modify this directly. There is a workaround to add the action for register_sidebar, get the sidebar object and then adjust the $wp_registered_sidebars global, but in order to do this, you would have to know the order id number of the specific widget. Doing it that way can be problematic.

Instance Variables

  • $title = apply_filters( 'widget_title', $instance['title'] );
  • $post_amount = $instance['show']; This is the posts per page (total posts to show)
  • $post_orderby = $instance['orderby'];
  • $post_order = $instance['order'];
  • $post_catin = $instance['catin']; Category In
  • $post_catout = $instance['catout']; Category Exclude
  • $pagecount = $instance['pagecount']; Numer of Posts to show (not used, this is so you can define total posts to query and number to show per tabbed interface which is not implemented in the plugin, but available for hooking)
  • $post_taxis = $instance['taxis']; Taxonamy slug
  • $post_taxterm = $instance['taxterm']; Taxonomy term ids, comma separated list
  • $post_typed = $instance['ptipe'];
  • $post_metakey = $instance['metakey'];
  • $post_metavalue = $instance['metavalue'];
  • $post_comparison = $instance['metacompare']; Meta comparison operator
  • $post_widgeid = $instance['widgetidentifier']; Widget Container ID
  • $post_widgeclass = $instance['widgetclassifier']; Widget Container Class
  • $post_readmoretitle = $instance['readmoretitle'];
  • $post_readmorelink = $instance['readmorelink'];

Plugin site: WorldpressRevolution

Pricing

Starting from $0 per month.

Check Out the Video Poll Widget

By Common Ninja

Video PollTry For Free!

App Info

Rating

Reviewers

1 reviews

Tags

popular posts
posts-widget
recent post
recent posts
recent posts widget

Developed By

aryanduntley

Quick & Easy

Find the Best Wordpress plugins for you

Common Ninja has a large selection of powerful Wordpress plugins that are easy to use, fully customizable, mobile-friendly and rich with features — so be sure to check them out!

Testimonial

Testimonial plugins for Wordpress

Galleries

Galleries plugins for Wordpress

SEO

SEO plugins for Wordpress

Contact Form

Contact Form plugins for Wordpress

Forms

Forms plugins for Wordpress

Social Feeds

Social Feeds plugins for Wordpress

Social Sharing

Social Sharing plugins for Wordpress

Events Calendar

Events Calendar plugins for Wordpress

Sliders

Sliders plugins for Wordpress

Analytics

Analytics plugins for Wordpress

Reviews

Reviews plugins for Wordpress

Comments

Comments plugins for Wordpress

Portfolio

Portfolio plugins for Wordpress

Maps

Maps plugins for Wordpress

Security

Security plugins for Wordpress

Translation

Translation plugins for Wordpress

Ads

Ads plugins for Wordpress

Video Player

Video Player plugins for Wordpress

Music Player

Music Player plugins for Wordpress

Backup

Backup plugins for Wordpress

Privacy

Privacy plugins for Wordpress

Optimize

Optimize plugins for Wordpress

Chat

Chat plugins for Wordpress

Countdown

Countdown plugins for Wordpress

Email Marketing

Email Marketing plugins for Wordpress

Tabs

Tabs plugins for Wordpress

Membership

Membership plugins for Wordpress

popup

popup plugins for Wordpress

SiteMap

SiteMap plugins for Wordpress

Payment

Payment plugins for Wordpress

Coming Soon

Coming Soon plugins for Wordpress

Ecommerce

Ecommerce plugins for Wordpress

Customer Support

Customer Support plugins for Wordpress

Inventory

Inventory plugins for Wordpress

Video Player

Video Player plugins for Wordpress

Testimonials

Testimonials plugins for Wordpress

Tabs

Tabs plugins for Wordpress

Social Sharing

Social Sharing plugins for Wordpress

Social Feeds

Social Feeds plugins for Wordpress

Slider

Slider plugins for Wordpress

Reviews

Reviews plugins for Wordpress

Portfolio

Portfolio plugins for Wordpress

Membership

Membership plugins for Wordpress

Forms

Forms plugins for Wordpress

Events Calendar

Events Calendar plugins for Wordpress

Contact

Contact plugins for Wordpress

Comments

Comments plugins for Wordpress

Analytics

Analytics plugins for Wordpress

Common Ninja Apps

Some of the best Common Ninja plugins for Wordpress

Browse our extensive collection of compatible plugins, and easily embed them on any website, blog, online store, e-commerce platform, or site builder.

Video Poll for Wordpress logo

Video Poll

Create interactive video polls that use engaging clips to boost participation, gather insights, and help visitors vote in a more dynamic way.

Feedback Popup for Wordpress logo

Feedback Popup

Collect user insights with a feedback popup that reveals issues early, improves user experience, and captures valuable leads through a clear feedback form.

Progress Bars for Wordpress logo

Progress Bars

Show progress clearly with animated progress bars that visualize goals, highlight achievements, and keep visitors engaged and motivated.

Accordion for Wordpress logo

Accordion

Add collapsible content sections to your site to organize information and help users navigate content more efficiently.

Tripadvisor Reviews for Wordpress logo

Tripadvisor Reviews

Show Tripadvisor reviews to build trust, improve credibility, and help visitors make confident booking decisions that support higher property sales.

Vimeo Feed for Wordpress logo

Vimeo Feed

Show Vimeo videos in a Vimeo feed that keeps content fresh and helps visitors discover more of your video library.

Donation Button for Wordpress logo

Donation Button

Add a donation button that lets users contribute easily using PayPal or Stripe, supporting causes directly from your site.

RSS Feed Carousel for Wordpress logo

RSS Feed Carousel

Show RSS content with an RSS feed carousel that updates automatically, displays posts in a smooth scrolling layout, and keeps visitors engaged.

Flip Cards for Wordpress logo

Flip Cards

Use flip cards to present information interactively, improve visual design, and guide visitors toward clearer decisions that support conversions.

Petition Form for Wordpress logo

Petition Form

Gather supporter signatures with a petition form that collects entries, saves submissions, sends notifications, and helps you drive meaningful change efficiently.

Countdown Bar for Wordpress logo

Countdown Bar

Add a countdown bar to your site to create urgency, highlight limited time offers, and drive faster engagement and higher conversions.

Vimeo Slider for Wordpress logo

Vimeo Slider

Show Vimeo videos with a Vimeo slider that displays clips in a smooth slider to boost engagement and keep visitors watching.

Discover Apps By Platform

Discover the best apps for your website

WordPress
Wix
Shopify
Weebly
Webflow
Joomla
PrestaShop
Shift4Shop
WebsiteX5
MODX
Opencart
NopCommerce

Common Ninja Search Engine

The Common Ninja Search Engine platform helps website builders find the best site widgets, apps, plugins, tools, add-ons, and extensions! Compatible with all major website building platforms - big or small - and updated regularly, our Search Engine tool provides you with the business tools your site needs!

Multiple platforms