-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
usage? #1
Comments
Looking for the same answer. Anyone? |
I figured out the usage:
However the plugin appears to be broken: **Warning: in_array() expects parameter 2 to be array, string given in /site/wp-content/plugins/cmb-attached-posts-master/attached-posts-field.php on line 52 Coreymcollins: Help!!! |
Hey Hey! Sorry for the delay in response, guys. I added a usage example, so if you're still having questions you can check that out. webface - I'm not getting that error at all. Can you let me know where that's happening for you? I didn't receive it on the front-end or back-end, and even moved all of my posts to draft mode to ensure that no posts would be found. I received no error on that line. draison, do you happen to receive the same error as webface is reporting above? Any info you can give me would be great! |
Corey I'm still getting the error. I down loaded the latest Custom-Metaboxes-and-Fields-for-WordPress-master and updated your plugin but i still get the same result. Warning: in_array() expects parameter 2 to be array, string given in /_mampsites/equinelle/wp-content/plugins/equinelleCMS/lib/cmb-attached-posts-master/attached-posts-field.php on line 52 Im using the following code.. $prefix = 'eqc';
|
It occurs on the back end. I havent tried cmb fields on the front end yet |
Bingo, found it - the issue was occurring on new pages without any posts attached yet. The $attached array was empty, so attempting to check it for values was failing. Pushed a fix, let me know if this does the trick for ou! |
Same problem here, I just have a list of posts and I can do anything with them. I can move, select or deselect them. |
I still cant get it to work. Any ideas. It just lists the posts. They are not selectable or draggable |
Problem solved. I looked through the code again and noticed that the javascript and css files in the plugin are not being loaded. I added them myself with the following code and presto.. plugin comes to life.
This plugin is great. Excellent work Cory. Draison hope this helps. |
I can drag and drop but its not saving any data. Lets dig in some more |
Thanks webface, the drag & drop function working now but like you I can't save any data. I will inspect the problem when i will have time. I'm a little busy with other works now. But your help is really appreciated. |
Hi , I have tried to setup this custom field to no avail. All the files are loading but the field is missing. Here is the code that I have used :- function wpb_initialize_cmb_meta_boxes() { add_action( 'init', 'wpb_initialize_cmb_meta_boxes', 9999 ); and the field is in a metabox using the following code:
When I look at the edit post page in wordpress the field is missing, thanks |
Hi guys, I am wondering if there has been a solution to this issue yet? I am trying to use the attached posts field to allow the client to pick a "next" and "previous" post but because of not being able to specify unique ids for the meta box I can't use two meta boxes for one post. Thanks. |
@schemedesigns we're trying to figure out your use case and what you mean by "allow the client to pick a 'next' and 'previous' post". Is this something that you want to be part of the UI for the backend as they're doing administration? Something on the frontend when viewing the site? |
@tw2113 Thank you for getting back to me. Sorry for being a little unclear. I will clarify a bit. What I am trying to create for my client is a presentation tool (think PowerPoint). Each page/post is a slide. On the frontend on the bottom of each slide are three navigation buttons "Previous slide", "Next slide" and "home". What I was hoping to achieve is to have two meta boxes on the backend where the client could pick which page/post the "next slide" and "Previous slide" buttons link to on each slide. I was hoping to have something like the attached screenshot on the backend. When setting up my meta boxes I have done the following array(
'name' => __( 'Next Page', 'scheme-presentations' ),
'desc' => __( 'This is where you specify the next page in the document navigation.', 'scheme-presentations' ),
'id' => $prefix . 'next_post',
'type' => 'custom_attached_posts',
),
array(
'name' => __( 'Previous Page', 'scheme-presentations' ),
'desc' => __( 'This is where you specify the previous page in the document navigation.', 'scheme-presentations' ),
'id' => $prefix . 'previous_post',
'type' => 'custom_attached_posts',
) When calling it in my template I would do so like this: $attached = get_post_meta( get_the_ID(), '_schemepres_next_post', true );
echo '<li><a href="' . get_permalink( $attached[0] ) . '">Next</a></li>';` I hope this clarifies a bit. Thank you! |
You may want to look into this field-type instead: https://github.com/WebDevStudios/CMB2-Post-Search-field It'll allow you to do multiple fields. |
@jtsternberg Thanks for the suggestion. That actually got me thinking and ended up following this example to create two dropdown menus. Thanks for the help! |
Good to hear you have a possible alternative solution to your original attempts @schemedesigns |
i am not getting post conetent |
how do you use and retrieve data from this field type?
The text was updated successfully, but these errors were encountered: