Forum Replies Created

Viewing 15 replies - 1 through 15 (of 2,431 total)
  • Thread Starter Michael Bishop

    (@miklb)

    Yes, 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.

    Thread Starter Michael Bishop

    (@miklb)

    I 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.

    Thread Starter Michael Bishop

    (@miklb)

    After 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?

    Thread Starter Michael Bishop

    (@miklb)

    If 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.

    Thread Starter Michael Bishop

    (@miklb)

    Ignore the part about not showing “New client created.” I’ve sorta turned myself inside out at this point.

    Thread Starter Michael Bishop

    (@miklb)

    No, 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 be chapel_new_client not new_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.

    Thread Starter Michael Bishop

    (@miklb)

    I’m starting to wonder if it has to do with the $post_types = $cmb->prop( 'object_types' );

    Thread Starter Michael Bishop

    (@miklb)

    The 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.

    Thread Starter Michael Bishop

    (@miklb)

    Just 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.

    Thread Starter Michael Bishop

    (@miklb)

    Yes, 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.

    Thread Starter Michael Bishop

    (@miklb)

    Thanks 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.

    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.

    Unfortunately, I do not have any guidance on that.

    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.

    Correct, 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.

Viewing 15 replies - 1 through 15 (of 2,431 total)