2017 © Pedro Peláez
 

wordpress-plugin cmb2-post-search-field

Custom field for CMB2 which adds a post-search dialog for searching/attaching other post IDs.

image

webdevstudios/cmb2-post-search-field

Custom field for CMB2 which adds a post-search dialog for searching/attaching other post IDs.

  • PHP
  • 2 Dependents
  • 0 Suggesters
  • 18 Forks
  • 13 Open issues
  • 3 Versions
  • 6 % Grown

The README.md

CMB2 Post Search field

Custom field for CMB2 which adds a post-search dialog for searching/attaching other post IDs., (*1)

Adds a new text field type (with a button), post_search_text that adds a quick post search dialog for saving post IDs to a text input., (*2)

Example

// Classic CMB2 declaration
$cmb = new_cmb2_box( array(
    'id'           => 'prefix-metabox-id',
    'title'        => __( 'Post Info' ),
    'object_types' => array( 'post', ), // Post type
) );

// Add new field
$cmb->add_field( array(
    'name'        => __( 'Related post' ),
    'id'          => 'prefix_related_post',
    'type'        => 'post_search_text', // This field type
    // post type also as array
    'post_type'   => 'post',
    // Default is 'checkbox', used in the modal view to select the post type
    'select_type' => 'radio',
    // Will replace any selection with selection from modal. Default is 'add'
    'select_behavior' => 'replace',
) );

Screenshots

  1. Field display
    Field display, (*3)

  2. Search Modal
    Search Modal, (*4)


If you're looking for a more general way to attach posts (or other custom post types) with a drag and drop interface, you might consider CMB2 Attached Posts Field instead., (*5)

The Versions

30/05 2016

dev-master

9999999-dev https://github.com/WebDevStudios/CMB2

Custom field for CMB2 which adds a post-search dialog for searching/attaching other post IDs.

  Sources   Download

GPL-2.0+

The Requires

  • php >5.2.4

 

plugin wordpress search field metabox

30/05 2016

v0.2.5

0.2.5.0 https://github.com/WebDevStudios/CMB2

Custom field for CMB2 which adds a post-search dialog for searching/attaching other post IDs.

  Sources   Download

GPL-2.0+

The Requires

  • php >5.2.4

 

plugin wordpress search field metabox

28/03 2016

v0.2.3

0.2.3.0 https://github.com/WebDevStudios/CMB2

Custom field for CMB2 which adds a post-search dialog for searching/attaching other post IDs.

  Sources   Download

GPL-2.0+

The Requires

  • php >5.2.4

 

plugin wordpress search field metabox