Forum Replies Created

Viewing 15 posts - 1 through 15 (of 33 total)
  • Author
    Posts
  • in reply to: Related posts vs postmeta? #7954
    Stephen
    Participant

    @sbruner – thanks, I will check it out when I get a chance. For the problem above, I ended up having to custom code my own backend ajax related post system, the only parts of piklist in use for that are the postmeta “__relate_post” meta key and the query parameter “post_belongs”, but that should allow me (when all of that is working) to hopefully swap it out. I will let you know what I find.

    in reply to: Related posts vs postmeta? #7949
    Stephen
    Participant

    Question for Steve: does the code currently up at github fix these problems? I have been combing through it and see reference in a comment to “Handle relate groups”

    in reply to: Piklist next version ETA and changes? #7946
    Stephen
    Participant

    Thank you!

    in reply to: Related posts vs postmeta? #7915
    Stephen
    Participant

    Here is what I have tried/noticed so far. The following code is only a slight change from the demo, but it works/fails in the following ways:

    1. I can relate posts from my CPT “action”, and they will show with the edit box and meta data field.
    2. I can update the regular POST fields like Title and content
    3. I CAN NOT update the associated meta data field (expiration_date). When changed it reverts back to whatever the separate CPT holds.
    4. Changing expiration_date to have a scope of post_meta links it to the parent instead of the child.
    5. Changing scope to the name of my CPT (‘action’) results in nothing working, just blank fields not attached to anything.
    6. I also notice that clicking “save” while in the parent will unfortunately publish instead (I suspect due to the presence on the child post of hidden field with post status of publish, but clearly it should only update the child status, not the parent)
    
     piklist('field', array(
        'type' => 'checkbox'
        ,'field' => '_' . piklist::$prefix . 'relate_post'
        ,'label' => __('Relate Posts', 'my-domain')
        ,'choices' => piklist(
          get_posts(array(
            'post_type' => 'action'
            ,'numberposts' => -1
            ,'orderby' => 'title'
            ,'order' => 'ASC'
          ))
          ,array('ID', 'post_title')
        )
        ,'relate' => array(
          'scope' => 'post'
        )
      ));
    
      $related = get_posts(array(
        'post_type' => 'action'
        ,'posts_per_page' => -1
        ,'post_belongs' => $post->ID
        ,'post_status' => 'publish'
        ,'suppress_filters' => false
      ));
    
    piklist('field', array(
        'type' => 'group'
        ,'scope' => 'post'
        ,'label' => 'Related Posts'
        ,'relate' => array(
          'scope' => 'post'
        )
        ,'add_more'=> true
        ,'fields' => array(
        
        array(
        'type' => 'datepicker'
        ,'field' => 'expiration_date'
        ,'required' => true
        ,'label' => __('Expiration Date', 'my-domain')
        ,'help' => __('Choose an expiration date for this item.', 'my-domain')
        ,'options' => array(
          'dateFormat' => 'yy-mm-dd'
        )
        ,'attributes' => array(
          'size' => 17
        )
      ) 
          ,array(
            'type' => 'text'
            ,'field' => 'post_title'
            ,'label' => 'Post Title'
            ,'columns' => 12
          )
          ,array(
            'type' => 'textarea'
            ,'field' => 'post_content'
            ,'label' => 'Post Content'
            ,'columns' => 12
            ,'attributes' => array(
              'rows' => 5
            )
          )
          ,array(
            'type' => 'hidden'
            ,'field' => 'post_status'
            ,'value' => 'publish'
          )
        )
      ));

    Anyone?

    Stephen
    Participant

    @sbruner – You are very welcome. Any chance you could give me a little advice on this issue? It is killing me.
    Thanks!

    in reply to: Related posts vs postmeta? #7907
    Stephen
    Participant

    Has anyone done something like this? Does anyone have any example code?

    in reply to: Related posts vs postmeta? #7904
    Stephen
    Participant

    I found something in the demo that gets at this idea: /parts/meta-boxes/field-relationship.php

    BUT, I can’t figure out how to add post-meta data to the related post. It will save the title and content shown in the demo, but every time I try to add another field there (for meta-data of the related post) it fails to save into the related post. Is this even possible?

    Stephen
    Participant

    I just traced it to this line in class-piklist-form.php:

    if (!is_wp_error($object) && is_object($object) && $allowed && is_array($object->$field))

    Changing it back to the previous:

    if (!is_wp_error($object) && is_object($object) && $allowed)

    Fixes it. Any ideas why this is happening?

    Stephen
    Participant

    I just verified that although this field is showing blank in the admin, it will save whatever value is typed into it. But then of course no one can edit the content because it won’t display after saving.

    in reply to: latest plugin shows everything on every tab #7875
    Stephen
    Participant

    I just realized that this is not caused by the helpers plugin, but rather by the piklist plugin update.

    Stephen
    Participant

    I finally wrote my own (not super elegant, but it works for me) workaround, which you can read about here:

    Front End Form Taxonomy Not Saving

    hope this helps.

    in reply to: "Success" message showing even if validation errors #7834
    Stephen
    Participant

    PRETTY PLEASE?

    in reply to: REST API problem with post_content field #7826
    Stephen
    Participant

    Well, I found a workaround for this:

    add_action( 'init', 'my_custom_rest_support', 25 );
      function my_custom_rest_support() {
    
    register_rest_field( 'my-cpt','long_description',
            array(
                'get_callback'    => 'get_long_desc',
                'update_callback' => '',
                'schema' => post
            )
        );        
    
    function get_long_desc( $post_id ) {
    global $post;
    $post_content = get_post(get_the_ID());
    $content = $post_content->post_content;
        return $content;
    }
    }

    So even though this is not showing twice in the admin, I can nevertheless add the field to the json REST response. Hope this helps someone else out…

    in reply to: Piklist next version ETA and changes? #7821
    Stephen
    Participant

    Hi Again. In the absence of any info about next release, is there at least a source repo we could look at for what has already been changed, and make the comparisons ourselves? It would be very helpful to at least get a sense of changes already made. Or if I am understanding the license for the software, would it make sense to fork it on a public github server so that others could contribute and make changes? I’m sorry to pester about this, but I have built a rather complicated project on top of it, and before deciding whether to continue using Piklist (on this and other projects) I need to get a sense if this product is EOL or in active development. I would be happy to pay a small fee for the product, and maybe you could put a donation button on your site to fund further development, I am sure many people would be happy to pay if it assured the product was moving forward. Anyway, thanks for listening.

    in reply to: "Success" message showing even if validation errors #7818
    Stephen
    Participant

    anyone?

Viewing 15 posts - 1 through 15 (of 33 total)