WordPress.org

Ready to get started?Download WordPress

Plugin Directory

!This plugin hasn't been updated in over 2 years. It may no longer be maintained or supported and may have compatibility issues when used with more recent versions of WordPress.

Promoted Post Widget

Simple widget to display (promote) a specific post/page. Set an expiration for this "promotion" to expire, with fallback to another post.

What are the options?

  • Title: The displayed widget title - leaving it blank will use the post title (if you override the default, see Hooks)
  • Feature Expires: until what date (YYYY-MM-DD) to show the promoted post; after which fall back to the default
  • Feature Post: choose from the dropdown of public post types to promote
  • Default: display this entry instead after the expiration
  • Trim summary to: if no excerpt is provided, shorten the post content to this number of words

Note that you can select the most recent post from the dropdown options.

How can I change the defaults?

If you don't specify certain options, the widget will use builtin defaults. Override these with the following hook: add_filter('abt_promo_post_defaults', 'YOUR_HOOK'); where YOUR_HOOK is a function that takes an array and returns the following settings:

function promo_widget_defaults($settings){
    return array(
            #'title'        => 'Latest From MY SITE',   // disable to use post title
            'display'   => 'Check out our new video! Credit goes to ... <p><a class="archive" href="/category/news">News Archive</a></p>',
            'url'       => '#',
            'image'     => '<img src="' . get_stylesheet_directory_uri() . '/images/g_video.jpg" alt="Latest from MY SITE">',
    );
}

What else can I use?

Two static methods are available for "embedding" the widget in code - basically just the internal processing used by the widget function.

abtcore_feature_widget::display_promo($args, $before_title, $after_title)

which uses the following

abtcore_feature_widget::get_promo($args)

to get either the promoted post or the default. $args will contain an array of the widget options (title, expire, promo, default, trim).

Function get_promo will return an array of (title, display, url, and image) to display_promo where it gets combined with the defaults from the hook to output the widget HTML.

Requires: 2.8 or higher
Compatible up to: 3.2.1
Last Updated: 2012-5-14
Downloads: 902

Ratings

0 stars
0 out of 5 stars

Support

Got something to say? Need help?

Compatibility

+
=
Not enough data

0 people say it works.
0 people say it's broken.