Michael Bishop
Forum Replies Created
-
Forum: Plugins
In reply to: [CMB2] Multiple Front End FormsYes, it is working for me. Didn’t know if you had any thoughts on why it might be firing on other pages, but I can mark this resolved. I’ll leave the gist out there in case someone else comes along with a similar problem.
Forum: Plugins
In reply to: [CMB2] Multiple Front End FormsI truthfully can’t explain it unless
cmb2_after_init
is loading on every page load, thus the 1st call to it (paper in my case) blocks the subsequent attempts to set the attributes.All I know is I commented out those lines in all of my CPT & was able to create new posts on the front end with no *apparent* issues.
This is a mu-plugin in a multi-site install (which I think I failed to mention) but wouldn’t think that would make a difference.
Forum: Plugins
In reply to: [CMB2] Multiple Front End FormsAfter doing a var_dump of $_Post, I can confirm
$_POST['atts']
are being clobbered and not passing into client CPT form.Edit
OK, I commented out this line (as well as the aforementioned unsets) and voila, the client form worked.
I’ve not encountered any issues *yet* with that commented out, reading between the lines, unsetting those values was for adding the image attachment?
Forum: Plugins
In reply to: [CMB2] Multiple Front End FormsIf you have a suggestion for submitting the from without using shortcode, I’m all ears. As I mentioned, that’s not imperative to my goal. Though I understand if you want to find a solution to original example I linked to.
Forum: Plugins
In reply to: [CMB2] Multiple Front End FormsIgnore the part about not showing “New client created.” I’ve sorta turned myself inside out at this point.
Forum: Plugins
In reply to: [CMB2] Multiple Front End FormsNo, they are not on the same page currently nor will they need to be.
A couple of things I found, the
$atts
was being set to the form ID not the shortcode. See Line 461 I think that should bechapel_new_client
notnew_client_metabox
However, changing that didn’t alter the outcome.
Also, when submitting a new client form, I’m not getting the success message of “New client created.” Paper however does.
Again, can’t thank you enough for your time and help on this.
Forum: Plugins
In reply to: [CMB2] Multiple Front End FormsI’m starting to wonder if it has to do with the
$post_types = $cmb->prop( 'object_types' );
Forum: Plugins
In reply to: [CMB2] Multiple Front End FormsThe shortcodes are only being used one per page template.
<?php echo do_shortcode( '[chapel_new_paper]' ); ?>
and<?php echo do_shortcode( '[chapel_new_client]' ); ?>
respectively.That line was also one that I was curious about, as well as
unset( $post_data['post_type'] ); unset( $post_data['post_status'] );
in the _new_post_form_submission functions.
I really do appreciate your help in this. I combed through this code for several days before reaching out.
Forum: Plugins
In reply to: [CMB2] Multiple Front End FormsJust re-read your thoughts on that function. I’m not using this in plugins, I’m using it as part of my own mu-plugin. But I’m sure I could modify the paths. I don’t think that relates to my issue currently though.
Forum: Plugins
In reply to: [CMB2] Multiple Front End FormsYes, that’s the plugin. I use that for front end editing of items to map the CMB2 title field t o the post title. So it isn’t being used in the shortcode post creation.
I’ll look at
cmb2_init
. My current method is an artifact of refactoring old code that was using a different method to create the CPT forms and slowly switching over.Note I’m using 2 instances currently of each form. One for editing and works on the backend, one for front end creation. They might be able to be combined at some point, but I wanted to keep both for now.
Forum: Plugins
In reply to: [CMB2] Multiple Front End FormsThanks Michael.
I put both files in a Gist
Note, this is being done through a mu-plugin. main.php basically loads the other CPT files. This can be refactored at a later date if need be (also loads other CPT, but paper does come first and works, the other CPT save but ignores the CPT and post_status.)
Also, I’m not married to this being done with a shortcode, but the example allowed me to quickly prototype out the front end work. I’m currently calling the shortcodes in a page template with
do_shortcode
anyway.Thanks again for a fresh set of eyeballs.
Forum: Hacks
In reply to: How to insert some code BEFORE 1st image in every post?Certainly there are ways to parse the 1st attached image, and you could include your code in that function, but personally, I’d use the featured image for that and insert the code above the call for the featured image in single.php.
Forum: Hacks
In reply to: Add custom field befor Biographical Info in Profile PageUnfortunately, I do not have any guidance on that.
Forum: Hacks
In reply to: How to insert some code BEFORE 1st image in every post?So you want to do it on the single.php, or in index.php?
I’m just curious why you can’t edit the templates.
Forum: Hacks
In reply to: Add custom field befor Biographical Info in Profile PageCorrect, I do not believe there is. You can add arbitrary fields to the Contact section easily enough, but not aware of adding to that section, or hiding it for that matter.