Forum Replies Created

Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • in reply to: piklist how for so long did not upgrade #885
    jchamb
    Member

    A new version is in the works, there was an update coming announcement a month or two ago. Great things take time, but I would expect at least a beta coming soon. Can’t wait for @Steve to drop some more info.

    in reply to: Grouped Fields Layout #868
    jchamb
    Member

    Sorry I was assuming you knew that the array was showing from what steve posted. Example step by step, starting from what Steve posted.

    $meta = get_post_custom($post_id);
    Then when you do the print_r you should see an array that looks something like you posted

    Array (
        [mhs_pedigree] => Array ( [0] => a:3:{s:7:”spacer1″;s:0:”";s:7:”spacer2″;s:0:”";s:8:”mhs_c3-1″;s:10:”grand sire”;} )
    )

    So $meta is now equal to an associative array that contains the key ‘mhs_pedigree’. mhs_pedigree is equal to another array which the first value (0) is serialized data.

    Basically what happens is when the data is saved by wordpress it takes your group piklist field, and creates and meta value, now for each field inside of that group it takes all of them as an array and runs php’s serialize function on them to create a single string of data. essinitally making your group field equal to a string.

    Okay, back to how you can use this. You need to be able to access each field’s value back individually from your mhs_pedigree, so lets follow the array down to the serialized data and convert that back to an array of data you can use.

    // Grab all of our custom post types
    $meta = get_post_custom($post_id);
    
    // turn mhs_pedigree into its own array.
    $mhs_pedigree = unserialize($meta['mhs_pedigree'][0]);
    print_r($mhs_pedigree);

    now the printed screen values should show something along this line (based on your fields)

    Array (
        [spacer1] => 'some_value',
        [spacer2] => 'some_value',
        [mhs_c3-1] => 'some_value
    )

    so to use those in your template then now you can user

    <?php echo $mhs_pedigree['mhs_cs-1']; ?>

    just note that i didn’t test anything, just trying to provide a rough example to explain what your seeing.

    in reply to: Grouped Fields Layout #866
    jchamb
    Member

    looks like the data is serialized. not sure what your current call looks like but once you have that array as a variable with that exact array structure you can do this

    $mhs_pedigree = unserialize($mhs_pedigree[0]);

    $mhs_pedigree should then be an array of individual values as an array.

    in reply to: Grouped Fields Layout #854
    jchamb
    Member

    @txhorselady. If i’m taking the correctly you should be able to hook up a custom template with out a label, and then add it to your field. Here is an example.

    In your functions.php add

    add_filter('piklist_field_templates', 'add_piklist_field_templates');
    
    function add_piklist_field_templates($templates)
    {
    	$templates['no_label'] = '[field_wrapper]
    		                          <div id="%1$s" class="%2$s">
    		                              [field_description_wrapper]
    		                                  <small>[field_description]</small>
    		                              [/field_description_wrapper]
    		                              [field]
    		                          </div>
    	                          [/field_wrapper]';
    
    	return $templates;
    }

    and then in your meta-box file

    piklist('field', array(
        'type' => 'group'
        ,'field' => 'my_group'
        ,'add_more' => true
        ,'label' => ''
        ,'description' => ''
        ,'template' => 'no_label' // custom template to not add label wrap
        ,'fields' => array(
            array(
            	'type' => 'textarea'
            	,'field' => 'column_1'
            	,'label' => 'Column 1'
                ,'columns' => 6
            )
            ,array(
            	'type' => 'textarea'
            	,'field' => 'column_2'
            	,'label' => 'Column 2'
                ,'columns' => 6
            )
        )
    ));
    in reply to: Custom Post Type Relationships #647
    jchamb
    Member

    fridata,

    Thanks for pointing that out. I used one of the previous built plugins as a template. must of forgot to change those before pushing it up to the repo. I fixed it, so a new download should work.

    in reply to: Custom Taxonomy not showing up on post edit. #582
    jchamb
    Member

    Ahh, I knew it had to be something dumb I was missing. Guess I was staring at it far to long. Thanks

    in reply to: 3.5 media insert broken with piklist demo turn on #578
    jchamb
    Member

    @Steve Thanks i’ll gladly accept it… I probably spent half a day trying to debug my plugins before i realized it was the addon. Didn’t get a chance to really dig into where the problem might be yet however.

    Going off of what @darrenturpin mentioned, it does seem to be related to javascript error, considering that the addon itself doesn’t have any js in there i’m guessing one of the fields that uses js is really the culprit.

    in reply to: Custom Post Type Relationships #522
    jchamb
    Member

    @Steve, whats your code look like. I wrote it out pretty quickly to match a project i have missed documenting something.

    in reply to: media upload #521
    jchamb
    Member

    @jason_lane I’ve been playing around with the 3.5rcs its pretty easy to get the new media uploader to work with what you already have written.

    line 152 set $classes = ‘piklist-image-field-link insert-media’;
    line 165 set $href= “”; (empty string)
    and then on your img tag (start line 177) also add a class=”insert-media”

    everything else should work fine.

    Two things to note… in my project i have the editor on screen so the necessary javascript for launching the new media browser is already there, so if you don’t have an editor you might nedd to add some scripts… i didn’t really look into that. And secondly if using editors you need to restore the original window.send_to_editor for tiny_mce add media to work.

    right under line 3
    var piklist_image_field_current = {};

    I added
    var send_to_editor_orig; (line 4)

    then right before replacing window.send_to_editor = window.piklist_image_field_send_to_editor; (roughly line 13) add

    send_to_editor_orig = window.send_to_editor;

    then last step is to restore the send to editor after you call tb_remove(); (roughly line 73) so add

    window.send_to_editor = send_to_editor_orig;

    After that everything should work pretty seamlessly.

    in reply to: Custom Post Type Relationships #509
    jchamb
    Member

    Like I said its pretty quick and dirty… but for what i needed (getting an id of a post to use) it works well.

    I’m def looking forward to seeing what the piklist guys come up with.

    in reply to: Custom Post Type Relationships #506
    jchamb
    Member

    I know the piklist guys are working on updating the relationship, but i needed a quick and dirty field for relating data so i created an addon. Link below for any one interested.

    https://github.com/jchamb/piklist-relationship-field

    in reply to: Custom Post Type Relationships #480
    jchamb
    Member

    @Steve- Just curious if these changes made it into the most recent update v0.6.9 Not exactly sure when the update was release (i updated yesterday).

    Thanks

    in reply to: Add More field inside an group field add more. #479
    jchamb
    Member

    @Steve – Thanks, and yes it would be a great feature. As i’ve been experimenting with frameworks, I know Pods 2 is also working on some similar functionality for “multiple looping”.

    As a work around I ended up just using a textarea and with my description asked each activity to be separated by a comma so i can just split the string into an array… still not as nice but it will do.

    Thanks again. Keep up the great work. I’m really loving Piklist so far!

Viewing 13 posts - 1 through 13 (of 13 total)