Skip to content

Commit 7e1293c

Browse files
committed
update readme and example again
1 parent b4b8a55 commit 7e1293c

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ If the ability to search for a post and attach it is more in line with what you
99

1010
## Installation
1111

12-
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).
12+
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).
1313

1414
## Customization
15-
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.
15+
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.
1616

1717
## Usage
1818
You can retrieve the meta data using the following:

example-field-setup.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,6 @@
2020
*/
2121
function cmb2_attached_posts_field_metaboxes_example() {
2222

23-
// Start with an underscore to hide fields from custom fields list
24-
$prefix = '_attached_cmb2_';
25-
2623
$example_meta = new_cmb2_box( array(
2724
'id' => 'cmb2_attached_posts_field',
2825
'title' => __( 'Attached Posts', 'cmb2' ),
@@ -35,7 +32,7 @@ function cmb2_attached_posts_field_metaboxes_example() {
3532
$example_meta->add_field( array(
3633
'name' => __( 'Attached Posts', 'cmb2' ),
3734
'desc' => __( 'Drag posts from the left column to the right column to attach them to this page.<br />You may rearrange the order of the posts in the right column by dragging and dropping.', 'cmb2' ),
38-
'id' => $prefix . 'attached_posts',
35+
'id' => 'attached_cmb2_attached_posts',
3936
'type' => 'custom_attached_posts',
4037
'options' => array(
4138
'show_thumbnails' => true, // Show thumbnails on the left

0 commit comments

Comments
 (0)