PHPackages                             amostajo/wordpress-add-on-post-picker - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. amostajo/wordpress-add-on-post-picker

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

amostajo/wordpress-add-on-post-picker
=====================================

Wordpress Post Picker Add-on for Wordpress Plugin and Theme templates.

v2.1.1(6y ago)066MITPHPPHP &gt;=5.4.0

Since Oct 29Pushed 6y ago1 watchersCompare

[ Source](https://github.com/amostajo/wordpress-add-on-post-picker)[ Packagist](https://packagist.org/packages/amostajo/wordpress-add-on-post-picker)[ RSS](/packages/amostajo-wordpress-add-on-post-picker/feed)WikiDiscussions v2.0 Synced 1mo ago

READMEChangelog (7)Dependencies (2)Versions (10)Used By (0)

Wordpress Post Picker ADD-ON
============================

[](#wordpress-post-picker-add-on)

[![Latest Stable Version](https://camo.githubusercontent.com/28a5393296bd0ef71c0a79aae81bae07738015c49ef54c737e3d42727efb0d7f/68747470733a2f2f706f7365722e707567782e6f72672f616d6f7374616a6f2f776f726470726573732d6164642d6f6e2d706f73742d7069636b65722f762f737461626c65)](https://packagist.org/packages/amostajo/wordpress-add-on-post-picker)[![Total Downloads](https://camo.githubusercontent.com/6cad6dc043e025c0cafbc383720a42c5bfe718ce32f9885549b2a9779aec9b8e/68747470733a2f2f706f7365722e707567782e6f72672f616d6f7374616a6f2f776f726470726573732d6164642d6f6e2d706f73742d7069636b65722f646f776e6c6f616473)](https://packagist.org/packages/amostajo/wordpress-add-on-post-picker)[![License](https://camo.githubusercontent.com/6545a52834a8d640a99a3a91a0f935f4ab0a9aee1bf9e149766dc8d1287c2862/68747470733a2f2f706f7365722e707567782e6f72672f616d6f7374616a6f2f776f726470726573732d6164642d6f6e2d706f73742d7069636b65722f6c6963656e7365)](https://packagist.org/packages/amostajo/wordpress-add-on-post-picker)

[![Wordpress Post Picker add-on](https://camo.githubusercontent.com/e1c0def8324308826560b3af100988b63a5baa14ce5ed77352a0b082d97c3715/687474703a2f2f73392e706f7374696d672e6f72672f34746f666332696b762f776f726470726573735f706f73745f7069636b65725f6164646f6e2e6a7067)](https://camo.githubusercontent.com/e1c0def8324308826560b3af100988b63a5baa14ce5ed77352a0b082d97c3715/687474703a2f2f73392e706f7374696d672e6f72672f34746f666332696b762f776f726470726573735f706f73745f7069636b65725f6164646f6e2e6a7067)

Add-on package for [Wordpress MVC](http://www.wordpress-mvc.com) exclusively.

Post Picker is a built-in **modal** that can be used within Wordpress' admin dashboard to pick / select posts.

\*\* THIS WILL CREATE CONFLICT WITH VueJS.

- [Installation](#installation)
    - [Configure in Template](#configure-in-template)
- [Usage](#usage)
    - [Enqueue on Main](#enqueue-on-main)
    - [HTML and JS](#html-and-js)
    - [Rendering](#rendering)
        - [Templates](#templates)
    - [Options](#options)
- [Coding Guidelines](#coding-guidelines)
- [Copyright](#copyright)

Installation
------------

[](#installation)

This package requires [Composer](https://getcomposer.org/).

Add it in your `composer.json` file located on your template's root folder:

```
"amostajo/wordpress-add-on-post-picker": "2.0.*"
```

Then run

```
composer install
```

or

```
composer update
```

to download package and dependencies.

### Configure in Template

[](#configure-in-template)

Add the following string line in your `addons` array option located at your template's config file.

```
    'Amostajo\Wordpress\PostPickerAddon\PostPicker',
```

This should be added to:

- `config\plugin.php` on Wordpress Plugin Template
- `config\theme.php` on Wordpress Theme Template

Usage
-----

[](#usage)

### Enqueue on Main

[](#enqueue-on-main)

Before you do any custom code, you need to load or enqueue the **Post Picker** to Wordpress.

Call `addon_post_picker()` function within your template's Main class, like this:

```
class Main extends Plugin
{
    public function metabox()
    {
        // The function must be called within your Main.php file
        $this->addon_post_picker();
    }
}
```

### HTML and JS

[](#html-and-js)

Create a clickable element, who will call the **Post Picker**:

```

    Add Posts

```

Init **Post Picker**, ala jQuery, with the options wanted:

```
$("#post-picker-caller").postPicker({
    render: false,
    success: function (posts) {
        // YOUR CUSTOM CODE HERE
        // Example:
        $.each(posts, function(index) {
            // Print post in console
            console.log(this);
        });
    }
});
```

### Rendering

[](#rendering)

**Post Picker** has a built-in rendering system that will lets you display the results easily.

To do this, you need two things in your HTML.

- **Template**: A template for each of the results to display.
- **Placeholder target**: A target element that will act as placeholder for the results.

Example using the previous sample:

```

    Add Posts

        {{ title }}

```

The javascript section should look like this:

```
$("#post-picker-caller").postPicker({
    target: "#post-picker-placeholder",
    templateElement: "#post-picker-templateholder"
});
```

**Post Picker** renders the results by default.

#### Templates

[](#templates)

There are 3 ways to set your template.

- **Inside caller** (Default): Your template will be the HTML inside the caller tags. In the example case `#post-picker-caller`.
- **An element**: Same as the previous example.
- **As option**: Pass it as jQuery option.

These are the available **Post** properties for display:

PropertyDescription`{{ ID }}`Post ID.`{{ title }}`Post title.`{{ slug }}`Post name / slug.`{{ permalink }}`Post permalink.`{{ image_id }}`Featured image ID.`{{ image_url }}`Featured image url.`{{ thumb_image_url }}`Featured image thumb url (120x120 px).`{{ post_type }}`Post type.`{{ post_date }}`Post date.`{{ excerpt }}`Excerpt of 15 words.### Options

[](#options)

OptionData typeDescription`allowMultiple`boolFlag that indicates multiple post can be selected or just 1. Default: true`render`boolFlag that indicates if plugin should render results. Default: true`clearTemplate`boolFlag that indicates if template should be cleared once plugin starts. Default: true`clearTarget`boolFlag that indicates if target should be cleared on every selection. Default: true`target`stringElement that will hold results.`template`stringHTML template.`templateElement`stringElement containing the template.`success`functionCallback function with the selected posts.Coding Guidelines
-----------------

[](#coding-guidelines)

The coding is a mix between PSR-2 and Wordpress PHP guidelines.

License
-------

[](#license)

**Post Picker** is free software distributed under the terms of the MIT license.

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~167 days

Recently: every ~127 days

Total

9

Last Release

2517d ago

Major Versions

v1.0.x-dev → v2.0.02018-02-03

### Community

Maintainers

![](https://www.gravatar.com/avatar/f2cdad4e398292477582ba8ec4ab02a96fa645cd620518a5bcf697cd788c96c3?d=identicon)[amostajo](/maintainers/amostajo)

---

Top Contributors

[![amostajo](https://avatars.githubusercontent.com/u/1645908?v=4)](https://github.com/amostajo "amostajo (6 commits)")

---

Tags

wordpresspickerpostadd-on

### Embed Badge

![Health badge](/badges/amostajo-wordpress-add-on-post-picker/health.svg)

```
[![Health](https://phpackages.com/badges/amostajo-wordpress-add-on-post-picker/health.svg)](https://phpackages.com/packages/amostajo-wordpress-add-on-post-picker)
```

###  Alternatives

[php-stubs/wordpress-stubs

WordPress function and class declaration stubs for static analysis.

19513.0M263](/packages/php-stubs-wordpress-stubs)[webdevstudios/cmb2-attached-posts

Custom field for CMB2 for creating post relationships.

13565.5k](/packages/webdevstudios-cmb2-attached-posts)[alexis-magina/cmb2-field-post-search-ajax

CMB2 field type to attach posts to each others. Search with Ajax.

3913.4k1](/packages/alexis-magina-cmb2-field-post-search-ajax)[smithfield-studio/acf-svg-icon-picker

Add ACF field for selecting SVG icons.

3710.8k](/packages/smithfield-studio-acf-svg-icon-picker)[wpbp/cpt_columns

Improve the CPT list in the backend for your CPTs

218.3k](/packages/wpbp-cpt-columns)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
