From 7e1293c5ddc58c848575f9ad10599ed7a0ec635f Mon Sep 17 00:00:00 2001 From: Justin Sternberg Date: Sat, 30 May 2015 22:58:20 -0400 Subject: [PATCH] update readme and example again --- README.md | 4 ++-- example-field-setup.php | 5 +---- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 64e51f0..f5ce16d 100644 --- a/README.md +++ b/README.md @@ -9,10 +9,10 @@ If the ability to search for a post and attach it is more in line with what you ## Installation -Follow the example in `example-field-setup.php` for a demonstration. The example assumes you have both CMB2 and this extension in your mu-plugins directory. If you're using CMB2 installed as a plugin, remove [line 6 of the example](https://github.com/WebDevStudios/cmb2-attached-posts/blob/master/example-field-setup.php#L6). +Follow the example in [`example-field-setup.php`](https://github.com/WebDevStudios/cmb2-attached-posts/blob/master/example-field-setup.php) for a demonstration. The example assumes you have both CMB2 and this extension in your mu-plugins directory. If you're using CMB2 installed as a plugin, remove [lines 6-9 of the example](https://github.com/WebDevStudios/cmb2-attached-posts/blob/master/example-field-setup.php#L6-L9). ## Customization -In the example file `example-field-setup.php`, the field is added using the prefix `_attached_cmb2_` and the name `attached_posts` which results in a meta key of `_attached_cmb2_attached_posts`. The example also demonstrates how to modify the `get_posts` query args. +The example demonstrates how to modify the `get_posts` query args, and allows you to toggle the thumbnails display as well as a filter search input. ## Usage You can retrieve the meta data using the following: diff --git a/example-field-setup.php b/example-field-setup.php index 3891b47..67e2f84 100644 --- a/example-field-setup.php +++ b/example-field-setup.php @@ -20,9 +20,6 @@ */ function cmb2_attached_posts_field_metaboxes_example() { - // Start with an underscore to hide fields from custom fields list - $prefix = '_attached_cmb2_'; - $example_meta = new_cmb2_box( array( 'id' => 'cmb2_attached_posts_field', 'title' => __( 'Attached Posts', 'cmb2' ), @@ -35,7 +32,7 @@ function cmb2_attached_posts_field_metaboxes_example() { $example_meta->add_field( array( 'name' => __( 'Attached Posts', 'cmb2' ), 'desc' => __( 'Drag posts from the left column to the right column to attach them to this page.
You may rearrange the order of the posts in the right column by dragging and dropping.', 'cmb2' ), - 'id' => $prefix . 'attached_posts', + 'id' => 'attached_cmb2_attached_posts', 'type' => 'custom_attached_posts', 'options' => array( 'show_thumbnails' => true, // Show thumbnails on the left