GithubHelp home page GithubHelp logo

cmb2 / cmb2-attached-posts Goto Github PK

View Code? Open in Web Editor NEW
135.0 40.0 62.0 574 KB

Custom field for CMB2 for attaching posts to a page.

License: GNU General Public License v2.0

PHP 67.75% CSS 5.38% JavaScript 26.87%
cmb2 php cmb2-attached-posts wordpress

cmb2-attached-posts's Introduction

CMB2

Gitter Travis Scrutinizer Code Quality Scrutinizer Coverage Project Stats

CMB2

Contributors: jtsternberg, webdevstudios, zao, humanmade
Homepage: https://cmb2.io
Tags: metaboxes, forms, fields, options, settings
Requires at least: 3.8.0
Requires PHP: 7.4
Tested up to: 6.4
Stable tag: 2.11.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Wordpress plugin Wordpress Wordpress rating

Complete contributors list found here: github.com/CMB2/CMB2/graphs/contributors

Description

CMB2 is a developer's toolkit for building metaboxes, custom fields, and forms for WordPress that will blow your mind. Easily manage meta for posts, terms, users, comments, or create custom option pages.

Download plugin on wordpress.org

CMB2 is a complete rewrite of Custom Metaboxes and Fields for WordPress. To get started, please follow the examples in the included example-functions.php file and have a look at the basic usage instructions.

You can see a list of available field types here.

If you are coming from the original "Custom Metaboxes and Fields for WordPress" plugin, please read this post for the CMB2 background story.

Contribution

Development occurs on Github, and all contributions welcome. Please read the CONTRIBUTING doc for more details.

A complete list of all our awesome contributors found here: github.com/CMB2/CMB2/graphs/contributors

Features:

Translation

If you are looking to provide language translation files, Please do so via WordPress Plugin Translations.

3rd Party Resources

Custom Field Types

Other Helpful Resources

Links

Installation

If installing the plugin from wordpress.org:

  1. Upload the entire /CMB2 directory to the /wp-content/plugins/ directory.
  2. Activate CMB2 through the 'Plugins' menu in WordPress.
  3. Copy (and rename if desired) example-functions.php into to your theme or plugin's directory.
  4. Edit to only include the fields you need and rename the functions.
  5. Profit.

If including the library in your plugin or theme:

  1. Place the CMB2 directory inside of your theme or plugin.
  2. Copy (and rename if desired) example-functions.php into a folder above the CMB2 directory OR copy the entirety of its contents to your theme's functions.php file.
  3. Edit to only include the fields you need and rename the functions (CMB2 directory should be left unedited in order to easily update the library).
  4. Profit.

View CHANGELOG

Known Issues

  • Not all fields work well in a repeatable group.

cmb2-attached-posts's People

Contributors

camdensegal avatar cehojac avatar clifgriffin avatar coreymcollins avatar guillaume-samson avatar johnnypea avatar jtsternberg avatar lmartins avatar lukasbesch avatar mckernanin avatar mixcas avatar mmcachran avatar pbearne avatar shelob9 avatar yelly avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cmb2-attached-posts's Issues

filter_boxes doesn't work

Hi,

I've the issue when i tried to activate filter_boxes, the filter field does not appear, my code in functions.php :

function cmb2_attached_posts_field_metaboxes(array $meta_boxes) {

        // Start with an underscore to hide fields from custom fields list
        $prefix = '_attached_wine_';

        $meta_boxes[] = array(
            'id'           => 'my_attached_posts_field',
            'title'        => __( 'Attacher des vins' ),
            'object_types' => array('tasting'), // Post type
            'context'      => 'normal',
            'priority'     => 'high',
            'show_names'   => false, // Show field names on the left
            'fields'       => array(
                array(
                    'name'    => __( 'Vins' ),
                    'desc'    => __( ' ' ),
                    'id'      => $prefix . 'attached_posts',
                    'type'    => 'custom_attached_posts',
                    'options' => array(
                        'query_args' => array(
                            'post_type' => 'product',
                            'tax_query' => array(
                                'taxonomy' => 'product_cat',
                                'field' => 'slug',
                                'terms' => 'vins'
                            )
                        ),
                        'show_thumbnails' => true,
                        'filter_boxes' => true
                    ),
                )
            ),
        );

        /* End CMB for Pages */

        return $meta_boxes;
    }

add_filter('cmb2_meta_boxes', 'cmb2_attached_posts_field_metaboxes');

Javascripts and CSS are loaded correctly

Any idea ?

Retrieving meta key value instead of ID

Hello :)

Im using Attached posts with Field Ajax Search in Wordpress:
https://github.com/rubengc/cmb2-field-ajax-search

  • I have a custom post type named Artworks, filled with Artworks entries.

  • I have a custom post type named Artists, filled with artists names that are linked with artworks.

  • I have a custom post type name Catalog, where selected artworks are attached to single catalogs using Attached Posts.

  • In each Artworks entries, I have a field using Field Ajax Search that retrieves these artist and assigns an artist to this the artwork.

  • In the catalog single page, Im trying to retrieve all artworks linked with this catalog.

From here, all is working. However, when trying to retrieve the artist name, it returns the ID instead of the name. How can I retrieve the name?

Thank you very much!

Limit Selection Number

Hi, this is a feature request.
Please add an option to limit the number of attached items.
In my case, i only want the user to select one item. Other cases could be a row of four.

Thanks.

Attach Woocommerce Products

Hi,

Is it possible to attach woocommerce products with a custom post type? If yes, can someone please tell me as I am new to CMB2. Thanks in advance.

Create a better experience when there are no posts to select from

Currently, if there are no posts to select from, the user sees a blank meta box and the edit screen appears to be broken.

Take this example, where there is an attached posts field within a meta box:
screen shot 2017-10-05 at 3 24 27 pm

When no posts are found, the user should see the same field interface (with search fields disabled, if visible) with a message that there are no posts to select from.

Mockup:
screen shot 2017-10-05 at 3 29 32 pm

Open links in new window

It's very cool that the posts are shown as links, but since they open in same window, that will cause to exit unsaved post. Should open in new window.

BTW, I love this field!

Usage with CMB2 repo version

I would prefer to keep using the Wordpress repository version of CMB2 with cmb2-attached-posts, is that possible?

Load max 20 post and search more by Ajax

Hello,

I would like to know if there is a way to load lets say 20 post and if we use the search that them it gets more posts by ajax, that are matching the search. because we have more the 20.000 post so we can't load the page.

Hope you can help us out

Custom column titles?

Thanks for the great plugin. Is there a way to change the default column titles "Available X" and "Attached X" ?

Min/max options

Is there a way to limit or require the number of attached posts similar as the relationship field of ACF?
I'm basically using this field in place of the post search field for the nicer UI but want the user to only select one post.

Removing deleted posts from already attached list

Thank you for this great plugin.
I didn't find this but not sure if its similar to "bidirectional relationship".

Is there a way to exclude the posts that have been originally deleted from the already attached list, without needing to resave or remove them manually?

example:
We have the following posts: postA, postB, postC
Under Related Posts (using cmb2 attached posts) for postA I have saved postB and postC.
After doing so I delete postC in the future. Can postC be excluded from postA Related Posts both in the front and back end?

Search button does not load just custom post type posts

I have a custom post type called billco-products and I have registered an attached posts field

$product_properties->add_field( array(
	'name'    		=> __( 'Related Products', 'o2dcaframework' ),
	'desc'    		=> __( 'Drag products from the left column to the right column to relate them to this product.<br />You may rearrange the order of the products in the right column by dragging and dropping.', 'o2dcaframework' ),
	'id'      		=> $prefix . 'related_products',
	'type'    		=> 'custom_attached_posts',
	'column'  		=> true,
	'options' 		=> array(
		'show_thumbnails' 	=> true,
		'filter_boxes'    	=> true,
		'query_args'      	=> array(
			'posts_per_page' 	=> 10,
			'post_type'      	=> array('billco-products'),
		),
	),
) );

When you click the the search button it pulls up the modal but doesn't list any posts. If I alter the post_type args array to be

'post_type'      	=> array('billco-products','page'),

and then go back and click the search button, I am returned with a list of all pages as well as all of the billco-products posts.

I am not sure where the disconnect is here. Honestly it would be great to even just hide the search box since the filter box is available.

usage?

how do you use and retrieve data from this field type?

Post type list display if there been attachment to post or not

Hello Guys,

My PHP knowledge a bit poor, but is there any options that I can add a line of code that will display in the list of posts if to that has been attached the file as PDF for example.

So if you go to post type you have the list of posts, there are columns, like Name, Categories, Tags and Date published, but is there any options to have an extra column called "Attachment" and bellow show like a paperclip, if not then is just empty.

Thanks in advance

screen shot 2017-11-09 at 12 37 29

Loop through attached posts on Blog Page

Hello!
Whenever Im trying to retrieve the attached posts from my blog page, it doesn't work.
It works on single posts or pages, but not the main blog page.

I tried to reset the query and post data after the main loop, I have remove the main blog loop to test too with no avail. Even with a var_dump, there are no values.

Is there something I'm missing?

My Custom field:
`function cmb2_attached_posts_field_metaboxes() {

$prefix = 'cmb';

$example_meta = new_cmb2_box( array(
    'id'           => 'cmb2_attached_posts_field',
    'title'        => __( 'Attached Posts', 'cmb2' ),
    'object_types' => array( 'page' ), // post type
    'show_on'      => array( 'key' => 'id', 'value' => array(925) ),
    'context'      => 'normal',
    'multiple' => true,
    'priority'     => 'high',
    'show_names'   => false, // Show field names on the left
) );
$example_meta->add_field( array(
    'name'    => __( 'Attached Posts', 'cmb2' ),
    'id'      => 'attached_cmb2_attached_posts',
    'type'    => 'custom_attached_posts',
    'options' => array(
        'show_thumbnails' => true,
        'filter_boxes'    => true, 
        'query_args'      => array( 'post' => 20 ),
    )
) );

}
add_action( 'cmb2_init', 'cmb2_attached_posts_field_metaboxes' );`
My Function:

function top_posts() { $attached = get_post_meta( get_the_ID(), 'attached_cmb2_attached_posts', true ); foreach ( (array) $attached as $key => $attached_post ) { var_dump($attached_post); echo '<hr>'; $studentlinks = get_page_link($attached_post); echo '<a href="' . $studentlinks . '">'; echo get_the_title ($attached_post) . '<br>'; echo '</a>'; }

Thank you!!

ERR_NAME_NOT_RESOLVED in the console

I've added a custom field to my CPT using CMB2 and this code:

$cmb->add_field( array(
	'name'    => __( 'Place', 'my-plugin-slug' ),
	'desc'    => __( 'The place where this playlist is going to be used', 'my-plugin-slug' ),
	'id'      => VBCPLM_Playlist_MetaKeys::$place,
	'type'    => 'custom_attached_posts',
  'options' => array(
    'show_thumbnails' => true, 
    'filter_boxes'    => true, 
    'query_args'      => array(
      'posts_per_page' => 10,
      'post_type'      => 'place_type',
    ), 
  ),
  'on_front'        => false 
));

but when the edit post backend page loads, I get the following in the console:

attached-posts-admin.css:1 Failed to load resource: net::ERR_NAME_NOT_RESOLVED
attached-posts.js:1 Failed to load resource: net::ERR_NAME_NOT_RESOLVED

and the attached posts field doesn't work (the '+' button does nothing).

I'm using the latest CMB2 code, up to date to the latest commit as of now.

List posts by post-type

It is really cool to set up the query also with an array of post types. e.g.:
'query_args' => array( 'post_type' => array( 'cpt_1', 'cpt_2', 'cpt_3' )

The headline and the placeholder of the filter-box shows all the post-type labels. But the resulting list needs it also because sometimes you need to select a post of a specific type.

A solution could be a second filter (select-box) with all post types. As an alternative there could be an optional parameter to print out the post-type-names in front of the post-names in the list.

PHP Warning: Use of undefined constant CMB2_ATTACHED_POSTS_FIELD_VERSION

Full error message:

[27-Aug-2020 20:21:12 UTC] PHP Warning: Use of undefined constant CMB2_ATTACHED_POSTS_FIELD_VERSION - assumed 'CMB2_ATTACHED_POSTS_FIELD_VERSION' (this will throw an Error in a future version of PHP) in /vagrant/content/mu-plugins/cmb2-attached-posts/init.php on line 38

This is happening with PHP 7.4, eventually this will likely break in PHP 8.

Customize post titles

I'd like to customize the display of post titles. In my case, I need to clearly display the selected post's status (draft, future, etc.), as I've modified the default query to allow non-published items.

Right now I'm doing this through some pretty blunt and ugly title filtering with standard WordPress functions. Is there a better way to accomplish this?

Field name arg isn't being used

The field name specified in

'name' => 'This should show up';

isn't being displayed at all, which makes it quickly confusing when you have more than one relationship on the same post (especially if those are relationships of a certain post type with the same post type)

storing the attached posts in separate post_meta fields

Would it feasible to have the option of storing the attached posts as separate entries in post_meta versus the current method of serialized arrays?

This would allow for more efficient many to many relationship queries.

Allow search button to be hidden

Currently, the search button is only hidden if users are being queried. It would be great to be able to hide the search button/modal if desired.

query posts by order in attached box & support for future posts

hey,
when i'm querying posts from the attached meta box - it quiers by their menu order and not by their order in the attachment meta box. is there a way doing that not uses foreach?

bonus question:
this is my meta box config:

        $cmb->add_field( array(
            'name'    => pll__( 'מאמרים לדף הבית בעברית', 'cmb2' ),
            'desc'    => pll__( 'יש לגרור את המאמרים או אירועים לטור הימני בכדי שויפיעו בעמוד הבית באתר בעברית.', 'cmb2' ),
            'id'      => $prefix . 'hebrew_posts',
            'type'    => 'custom_attached_posts',
            'options' => array(
                'show_thumbnails' => false, // Show thumbnails on the left
                'filter_boxes'    => true, // Show a text box for filtering the results
                'query_args'      => array( 'posts_per_page' => -1, 'post_type'=>array('post', 'events','page', 'courses'), 'post_status' => array( 'publish','future' )), // override the get_posts args
            )
        ) );

and yet, it dosent displays future status posts.
does it supported?

Compatibility issue with repeatable fields

cmb2-attached-posts won't works with CMB2 repeatable fields.

Fields are cloned but not resetted, and there is an error with assigning draggable/droppable jquery-ui to cloned elements.

I solved this way:

if (window.CMBAP) {
  jQuery('.cmb-repeatable-group').on('cmb2_add_row', function(event, newRow) {
    var app = window.CMBAP;

    // draggables
    app.cache();
    app.makeDraggable();
    app.makeDroppable();

    // reset
    jQuery(newRow).find('.attached-posts-wrap').each(function() {
      var $wrap = jQuery(this);
      $wrap.find('.attached-posts-ids').val('');

      $wrap.find('.retrieved li').each(function() {
          jQuery(this).removeClass('added');
      });
      $wrap.find('.attached li').each(function() {
          jQuery(this).remove();
      });

      app.resetAttachedListItems($wrap);
      app.updateReadOnly($wrap);
      app.updateRemaining($wrap);
    });

    app.cache();
  });
}

👋

Related posts in checkbox list

This add-on has saved me so much time. I really appreciate the work that's gone into both CMB2 and this add-on.

Is there a good way to retrieve the list of available posts in a list with checkboxes, instead of the drag-and-drop UI currently implemented?

If there's a way to do this already(with this add-on or not) I'd love to hear it, otherwise this can be filed under feature request.

'undefined constant' error

Hi,
I think this custom field code is great.
I have previously used it by dropping it into the cmb2 library files and it has worked fine that way.

I'm trying a new way now by dropping the files into the mu-plugins directory as suggested elsewhere.
CMB2 is installed as a WP plugin (I have removed the necessary lines of code because of this).
I was just checking the example-field-setup.php file worked fine, but unfortunately I get this error on the page where the meta box is partially appearing (due to the scripts and css not getting enqueued)

Notice: Use of undefined constant CMB2_ATTACHED_POSTS_FIELD_DIR - assumed 'CMB2_ATTACHED_POSTS_FIELD_DIR' in /home/redcom/public_html/stsaviours/wp-content/mu-plugins/init.php on line 220

The constant was obviously defined in the cmb2-attached-posts-field.php file where the init.php file was required as otherwise it wouldn't have been able to include it.

Any ideas what's going wrong?

Thanks,
Nath

My custom post types are not being queried on 1.2.6

Hello,

I've registered a custom post type and created a cmb2 attached posts field in my options page:

$cmb->add_field( array(
    'name'    => __( 'Projects', 'glp' ),
    'desc'    => __( 'Drag...', 'glp' ),
    'id'      => 'projects_en_arr',
    'type'    => 'custom_attached_posts',
    'options' => array(
        'show_thumbnails' => true, // Show thumbnails on the left
        'filter_boxes'    => true, // Show a text box for filtering the results
        'query_args'      => array(
            'post_type' => 'projects',
            'post_status' => 'publish',
            'posts_per_page' => -1
        ),
    ),
) );

These are the CPT args , (I'm using extended_cpts to register it) :

'public'             => true,
'publicly_queryable' => true,
'show_ui'            => true,
'show_in_menu'       => true,
'query_var'          => true,
'capability_type'    => 'post',
'has_archive'        => false,
'hierarchical'       => false,
'menu_position'      => 6,
'supports'           => array( 'title', 'author', 'thumbnail','editor' ),

This returns no results in the given metabox on the admin screen, however, if I change post type to 'page' or 'post' it works as expected.
I've tried to register a fresh custom post type and that one did not work as well.
Also tried on a different website and same results.

I downgraded to 1.2.4 , works well.

Thanks a lot.

Deleting Attached Posts Creates Error within Custom Field

If you delete an attached post it shows an error on the parent post. I've solved the issue using hooks, code below, let me know where to add this into the plugin itself and I'll PR.

// These two function fix cmb2_attached_posts issue where a related post is deleted and causes an error to show in the WP backend

// Loop through attached posts and create attached_posts_attached_to meta value
function add_attached_to_meta_after_cmb2_save_field( $field_id, $updated, $action, $instance ) {
	$parent_id = $instance->data_to_save['post_ID'];

	if(substr( $field_id, 0, 8 ) === 'related-') {
		$posts = $instance->value;

		if(is_array($posts) && count($posts)) {
			foreach ($posts as $post_id) {
				$existing_meta = false;
				$new_meta = [];

				// Add this post id to the array meta
				// attached_posts_attached_to
				$existing_meta = get_post_meta($post_id, 'attached_posts_attached_to');

				$new_meta[] = $parent_id;

				if(is_array($existing_meta[0])) {
					$new_meta = array_unique(array_merge($existing_meta[0], $new_meta), SORT_REGULAR);
				}
				$add_meta = update_post_meta($post_id, 'attached_posts_attached_to', $new_meta);

			}
		}
	}
}

// add the action
add_action( 'cmb2_save_field', 'add_attached_to_meta_after_cmb2_save_field', 10, 4 );

function remove_related_post_attachements_meta_before_delete_post( $post_id ) {
	$attached_to = get_post_meta($post_id, 'attached_posts_attached_to');

	foreach ($attached_to[0] as $parent_post_id) {
		// Remove the item from the related arrays on that parent post
		$parent_meta = get_post_meta($parent_post_id);

		foreach ($parent_meta as $meta_key => $meta_value) {
			if(substr( $meta_key, 0, 8 ) === 'related-') {
				$parent_meta = get_post_meta($parent_post_id, $meta_key);
				$parent_meta = $parent_meta[0];

				// Remove the post_id from the post we're deleting form the attached meta array
				if (($key = array_search($post_id, $parent_meta)) !== false) {
				   unset($parent_meta[$key]);
				}
				$new_meta = update_post_meta($parent_post_id, $meta_key, $parent_meta);
			}
		}
	}
}

add_action( 'before_delete_post', 'remove_related_post_attachements_meta_before_delete_post' );

Search data append wrong

Hi Team,
Thank you for your plugin.
I have one issue:
I using two field with type: custom_attached_posts
When I click the search button and select the data, I see the value returned is showing the wrong position. You can see a screenshot I attached below.
http://prntscr.com/dziula
Thanks

Reciprocal Relationships?

Is there a way to use the relationship both ways (reciprocal)?

For instance lets say I have 2 CPTs - cars and car parts.

So when editing a car, you can drag the part or parts to attach them.

When editing a part, is there a way I can see and manage all the cars that are already attached to it?

I can write a function to do this - just looking for a shortcut if it's already built in somehow. Thanks

Multiple post types issue

Hi! Thanks for this great addon!

I'm experiencing a strange behavior.

I have configured the field with these arguments:

'query_args' => array (
'post_type' => ['post', 'tweets_sus', 'news_sus'],
),

And the posts of the type 'tweets_sus' do not appear. Only the posts of type 'post' and 'news_sus' appear.

If I modify it to leave it like this:

'query_args' => array (
'post_type' => ['tweets_sus'],
),

Then they appear.

The strangest thing is that if I make an independent query (With WP_Query() ) in any place of the same website with the 3 CPTs, all the results appear and i'm setting the exact same arguments to the module.

I have even modified the code from cmb2-attached-posts and I have reached the get_objects() function in init.php and I have verified that the arguments there, including the CPT 'tweets_sus' arrive correctly, but the get_posts() function returns only two CPT results. In the same function i try with WP_Query() and the results are wrong two.

This is the strangest thing, because i'm calling WP_Query() with same params outside the module and all works.

Any suggestion will be appreciated

Search Posts, attachment limits and attaching Terms

While really useful as it is, I believe it could really improve with a few changes:

  1. Search posts
    I've noticed theres a field dedicated to that functionality, but something in the lines of what ACF does would be really awesome. When you have a lot of posts, the current presentation won't scale well, hence the need for some sort of search functionality.
  2. Limit Attachments
    Would be possible to limit ao many attachments the user can add?
  3. Attaching Terms
    It would be very useful if we could attach other types of contents, such as categories, custom post-types, etc.

Thank you CMB2 and this useful extension.

Problems with returned data.

Hi guys, Thank you for your plugin.
I have one small issue: When i tried get values from field I got string but not array.

$prefix = 'products';
$cmb = new_cmb2_box(array(
        'id' => $prefix.'related_list',
        'title' => 'Related products',
        'object_types' => array('product'), 
        'context' => 'normal',
        'priority' => 'high', 
        'show_names' => true,
    ));
$cmb->add_field( array(
        'name'     => __( 'Related Products', 'cmb2' ),
        'desc'     => __( 'Drag products from the left column to the right column to attach them to this page.<br />You may rearrange the order of the products in the right column by dragging and dropping.', 'cmb2' ),
        'id'       => $prefix.'related_list',
        'type'     => 'custom_attached_posts',
        'multiple' => true,
        'options'  => array(
            'show_thumbnails' => true,
            'filter_boxes'    => true,
            'query_args'      => array(
                'post_type' => 'product',
            ),
        )
    ) );
$products_list = get_post_meta(get_the_ID(), 'products_list', true);
print_r(gettype($products_list)); // result string

Installation / Usage example for theme which bootstraps CMB2

Hello. Thanks for the CMB2 Attached Posts, I'm giving it a try right now.

My theme comes bundled with a plugin which requires CMB2 init.php file. If I'm not wrong this method is called bootstrap, so the issue is CMB2 is initiated through another required plugin.

So far I'm able to install some CMB2 add-ons as any other WordPress plugin while using those along with my theme's CMB2 set up, but I'm not sure about CMB2 Attached Posts installation instructions as long as it reads _"If you're using CMB2 installed as a plugin, remove lines 6-9 of the example."_

So the issue is if I don't use CMB2 as a plugin, where I'm supposed to place CMB2 Attached Posts files? Also, how and in which file would I require it?

Thanks in advance.

add number/text to each post

First: Thanks a lot for the plugin. Now I have a question (or maybe feature request). Is there any possiblity to add a field to each post to be able to add a number or text to the id of the post in the array? The use case would be to have a post type with incredients which I can select with a default amount. With the additional number I could add a factor to the incredient for the recipe. If e.g. the default amount would be 100g I then would like to add 1.5 in that field to be able to display 150g on the post. Or another use case could be to add a color to display titles in different colors. So if it is not possible yet it would be very nice to be able to do this.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.