Title: Picker
Author: Andrea Landonio
Published: <strong>6. Januar 2015</strong>
Last modified: 14. März 2021

---

Plugins suchen

![](https://ps.w.org/picker/assets/banner-772x250.jpg?rev=2091343)

Dieses Plugin wurde **nicht mit den 3 neuesten Hauptversionen von WordPress getestet**.
Es wird möglicherweise nicht mehr gepflegt oder unterstützt und kann bei der Verwendung
mit neueren WordPress-Versionen zu Kompatibilitätsproblemen führen.

![](https://ps.w.org/picker/assets/icon-256x256.png?rev=2091343)

# Picker

 Von [Andrea Landonio](https://profiles.wordpress.org/lando1982/)

[Herunterladen](https://downloads.wordpress.org/plugin/picker.1.1.6.zip)

 * [Details](https://de.wordpress.org/plugins/picker/#description)
 * [Rezensionen](https://de.wordpress.org/plugins/picker/#reviews)
 *  [Installation](https://de.wordpress.org/plugins/picker/#installation)
 * [Entwicklung](https://de.wordpress.org/plugins/picker/#developers)

 [Support](https://wordpress.org/support/plugin/picker/)

## Beschreibung

Picker is a simple and flexible plugin which allow users to choose a specific post
inside admin widgets page and display it in their site frontend.

If you need to display a specific post, not a generic list of last posts, top ranked
posts, category posts, etc.. but only the one that you configure in the backend.
Picker plugin makes it possible in a very quick and easy way. It adds a widget on
the admin widgets page that you can use to select and show a post on your site’s
frontend. You can work with standard types (like posts) and custom types simply 
by changing the settings page of the plugin.

Picker plugin is extensible in many of its features, such as, applying filters and
action, managing layout template, etc.. moreover, plugin is based on the WordPress
Transient API for caching issue.
 As mentioned before, the plugin provides a way
to override the default layout template. With a few lines of code, you can create
your layout template (copying the default one) and completely override the plugin
look&feel thanks to a complete access to all widget item data throw Picker classes.

#### Widget usage

You can use Picker plugin like all the other WordPress plugins, dragging the widget
to a sidebar you can enable a Picker widget. Initially, the widget is not published
on the frontend. In this way you can safely configure widget’s data and then publish/
display the widget.
 Picker widget is composed by the following fields:

 * _Publish checkbox_: flag it to publish the widget
 * _Widget title_: a widget title, for backend and users only, not shown on frontend
 * _Post list_: a lists of the last posts by date
 * _Post search_: a search field to provide a post ID or search it if post is not
   in the above post list
 * _Time to publish_: a datetime to set when the widget could be shown on frontend
 * _Time to expire_: a datetime to set when the widget should be removed from frontend
 * _Alternative URL_: an alternative URL instead the default posts permalink
 * _Alternative title_: an alternative title instead the default post_title field
 * _Alternative excerpt_: an alternative excerpt instead the default post_excerpt
   field

For some field there is a jQuery validation to check right formats. Picker plugin
checks all numbers, url and datetime fields showing you an alert if data are wrong.

#### Customizing layout template

Picker plugin provide a default widget template that show a linked title (using 
post title), the featured image of the post and the post excerpt. Alternatively,
you can manage widget template overriding default template. Picker plugin has a 
tool to detect the template path used for widget layout inclusion.
 This is the 
load order of the template files:

 * theme / template_path / template_name (default: theme template folder)
 * theme / template_name (default: theme root folder)
 * default_path / template_name (default: plugin templates folder)

#### Plugin filters

Picker plugin provides many filters to extend default behavior of the plugin core
functions. This is a list of the most important available filters:

 * _picker\_item\_title_: allow to modify picker item title
 * _picker\_item\_excerpt_: allow to modify picker item excerpt
 * _picker\_item\_content_: allow to modify picker item content
 * _picker\_template\_path_: allow to modify layout template path

To better understand how you can interact with plugin filters, here are some examples.

If you want, you can modify the default (usually „picker/“ folder), with a folder
in your theme root. In the following example, adding the function to your „functions.
php“ theme file, we are telling to Picker plugin to search template files inside
a „templates/“ folder in your theme root.

    ```
    function modify_picker_template_path() {
        return 'templates';
    }
    add_filter( 'picker_template_path', 'modify_picker_template_path' ); 
    ```

Also, you can modify the default post title (usually „post_title“ field), adding
for example a prefix/suffix. In the following example, adding the function to your„
functions.php“ theme file, we are telling to Picker plugin to call your function
before return to template the item post title value.

    ```
    function modify_picker_post_title( $value ) {
        return 'my_prefix ' . $value;
    }
    add_filter( 'picker_item_title', 'modify_picker_post_title' ); 
    ```

#### Template utility class and functions

As described in the previous paragraph, you can customize widget template according
to you site specs. Inside the template file you can use a `$picker_item` global 
variable to access the picker class methods:

 * _get\_post\_data()_: get WP_Post object
 * _get\_permalink()_: get post permalink
 * _get\_title()_: get post title
 * _get\_excerpt($max\_words = “, $use\_content\_if\_empty = false)_: get post excerpt
 * _get\_content($max\_words = “)_: get post content
 * _get\_categories($sep = ‚, ‚, $before = “, $after = “)_: get post categories 
   as a list of category links
 * _get\_tags($sep = ‚, ‚, $before = “, $after = “)_: get post tags as a list of
   tag links
 * _get\_formats($sep = ‚, ‚, $before = “, $after = “)_: get post formats as a list
   of format links
 * _has\_image()_: tell if post has image
 * _get\_image($size = ‚thumbnail‘, $attr = array())_: get post featured image (
   use `thumbnail`, `medium`, `large`, `full` default sizes or your registered new
   image size)
 * _get\_image\_id()_: get post featured image ID
 * using `__get` magic method you can read a custom field (eg: $picker_item->my_custom_field)

In addition to `$picker_item` global variable, you can use custom variables values,
such as:

 * _get\_custom\_url()_: the provided alternative post URL
 * _get\_custom\_title()_: the provided alternative post title
 * _get\_custom\_excerpt()_: the provided alternative post excerpt
 * _get\_widget\_sidebar()_: which sidebar contains the the widget
 * _get\_widget\_order()_: the widget order (position)

In the template file are available special variables, for now:

 * _$use\_cache_: boolean

Very important is the `widget_sidebar` variable. With this value you can display
a different widget layout according to which sidebar contains the widget.

#### Caching management

To increase performance and reduce database queries Picker plugin use a persistent
caching management. To get a persistent cache without using external plugins Picker
plugin uses [WordPress Transient API](https://codex.wordpress.org/Transients_API).

Anytime WordPress display Picker plugin on a site frontend page a calls Picker plugin
widget management. First of all, Picker plugin look for a cached object into Transient
cache, if found it, gets data, prepares HTML and provides it to frontend. If data
isn’t in Transient cache, Picker plugin go on with widget date and status validation,
then, after looked up post into database, create Picker item object that contains
all the widget post data, and in the end like a cached object prepares HTML and 
provides it to frontend. Before concluding by Picker plugin widget management, the
Picker item is saved to Transient cache. Only the Picker item is saved to cache,
no HTML neither frontend logic are saved to cache. The goal to Picker caching management
is only to reduce database usage. Picker plugin cache has many expiration rules,
the most important are:

 * widgets are cached 5 minutes if you specify a time to publish or a time to expire
 * widgets are cached 1 day if you don’t specify a time to publish and a time to
   expire
 * widgets cache expire if you update the widget
 * widgets cache expire when one of the following action is triggered:
    - save_post
    - deleted_post
    - publish_future_post
    - switch_theme

#### Verwendung

 1. Go to _WP-Admin -> Appearance -> Widgets_.
 2. Drag _Picker_ widget to a sidebar.
 3. Customize _Picker_ widget.

Links: [Author’s Site](http://www.andrealandonio.it)

## Screenshots

 * [[
 * Widget admin page (customizing widget)
 * [[
 * Widget admin page (datetimepicker usage)
 * [[
 * Frontend widget layout
 * [[
 * Admin settings page

## Installation

 1. Unzip the downloaded _picker_ zip file
 2. Upload the _picker_ folder and its contents into the _wp-content/plugins/_ directory
    of your WordPress installation
 3. Activate _picker_ from Plugins page

## FAQ

### Works on multisite?

Ja

### How works with different locales?

Plugin works with 2 different locale and formats:

 * italian locale date format „dd/mm/yy“
 * default locale date format „mm/dd/yy“

### Can I use my custom image sizes on widget?

Yes, in addition to predefined image formats, you can display your registered image
sizes

### Works on with custom post types?

No, for now only standard post types are available

## Rezensionen

![](https://secure.gravatar.com/avatar/88f949545ced02da3a5804a1731db949346344004473f1d898151622ad2969e7?
s=60&d=retro&r=g)

### 󠀁[Great plugin](https://wordpress.org/support/topic/great-plugin-21870/)󠁿

 [Em](https://profiles.wordpress.org/mcottell/) 21. Mai 2019 1 Antwort

Very effective for being able to pick exactly what post you what to highlight.

 [ Alle 2 Rezensionen lesen ](https://wordpress.org/support/plugin/picker/reviews/)

## Mitwirkende und Entwickler

„Picker“ ist Open-Source-Software. Folgende Menschen haben an diesem Plugin mitgewirkt:

Mitwirkende

 *   [ Andrea Landonio ](https://profiles.wordpress.org/lando1982/)

[Übersetze „Picker“ in deine Sprache.](https://translate.wordpress.org/projects/wp-plugins/picker)

### Interessiert an der Entwicklung?

[Durchstöbere den Code](https://plugins.trac.wordpress.org/browser/picker/), sieh
dir das [SVN-Repository](https://plugins.svn.wordpress.org/picker/) an oder abonniere
das [Entwicklungsprotokoll](https://plugins.trac.wordpress.org/log/picker/) per 
[RSS](https://plugins.trac.wordpress.org/log/picker/?limit=100&mode=stop_on_copy&format=rss).

## Änderungsprotokoll

#### 1.1.6 – 2021-03-14

 * Tested up with WordPress 5.7 release

#### 1.1.5 – 2020-12-09

 * Tested up to latest WordPress releases

#### 1.1.3 – 2019-05-22

 * Updated WordPress requirements

#### 1.1.1 – 2019-05-20

 * Fixed deprecated constructor methods

#### 1.1.0 – 2016-06-30

 * Added custom types management

#### 1.0.0 – 2015-01-01

 * First release

## Meta

 *  Version **1.1.6**
 *  Zuletzt aktualisiert **vor 5 Jahren**
 *  Aktive Installationen **10+**
 *  WordPress-Version ** 4.0 oder höher **
 *  Getestet bis **5.7.15**
 *  Sprache
 * [English (US)](https://wordpress.org/plugins/picker/)
 * Schlagwörter
 * [admin](https://de.wordpress.org/plugins/tags/admin/)[pick](https://de.wordpress.org/plugins/tags/pick/)
   [picker](https://de.wordpress.org/plugins/tags/picker/)[usability](https://de.wordpress.org/plugins/tags/usability/)
   [widget](https://de.wordpress.org/plugins/tags/widget/)
 *  [Erweiterte Ansicht](https://de.wordpress.org/plugins/picker/advanced/)

## Bewertungen

 5 von 5 Sternen.

 *  [  2 5-Sterne-Rezensionen     ](https://wordpress.org/support/plugin/picker/reviews/?filter=5)
 *  [  0 4-Sterne-Rezensionen     ](https://wordpress.org/support/plugin/picker/reviews/?filter=4)
 *  [  0 3-Sterne-Rezensionen     ](https://wordpress.org/support/plugin/picker/reviews/?filter=3)
 *  [  0 2-Sterne-Rezensionen     ](https://wordpress.org/support/plugin/picker/reviews/?filter=2)
 *  [  0 1-Sterne-Rezensionen     ](https://wordpress.org/support/plugin/picker/reviews/?filter=1)

[Your review](https://wordpress.org/support/plugin/picker/reviews/#new-post)

[Alle Rezensionen anzeigen](https://wordpress.org/support/plugin/picker/reviews/)

## Mitwirkende

 *   [ Andrea Landonio ](https://profiles.wordpress.org/lando1982/)

## Support

Möchtest du etwas mitteilen? Brauchst du Unterstützung?

 [Support-Forum anzeigen](https://wordpress.org/support/plugin/picker/)