Forum Replies Created

Viewing 15 posts - 136 through 150 (of 330 total)
  • Author
    Posts
  • in reply to: Problem in backend #6431
    Jason
    Keymaster

    Hey @mariusnicula!

    What version of Piklist are you using? And are you using the 'template' attribute on the field? Can you please paste the field code here?

    Thanks!

    in reply to: Aspect of fields #6430
    Jason
    Keymaster

    Hey @mariusnicula!

    First, you can always add your own css to the admin-side of WordPress. With that you can adjust the styles however you’d like. Just use the admin_enqueue_scripts filter.

    Next, it’s intended for groups, but even outside of them you can use the 'columns' attribute in fields to fit your fields within a 12 unit grid. So 'columns' => 12 is full-width.

    Finally, for total customization, check out field templates.

    Hope this helps!

    Jason
    Keymaster

    Glad Kevin was able to clear it up. Thanks for posting the solution here!

    Jason
    Keymaster

    Hi Donna!

    That’s no good. That’s obviously important.

    I’m looking into this. Can you please verify that if you look in $_GET instead of $_POST you’re not seeing the ID in there, either? The $_POST will contain the results of the form, but it looks like the fields are also being stored in the query var of the redirect url.

    Thanks!

    in reply to: Trying to get all categories that has linked posts #6355
    Jason
    Keymaster

    Hi @cannect!

    Sorry for the late reply! Hopefully you’ve already looked into taxonomies a bit more, but in case you haven’t I suggest reading about them here: https://codex.wordpress.org/Taxonomies

    It’s not a Piklist feature; it’s a feature of WordPress itself that allows you to add tag/category type structures to any post type (or even share between post types).

    Hope this helps!

    in reply to: Conditions when fields are empty #6327
    Jason
    Keymaster

    Ah, gotcha. We ran into this in the other thread, too. When you grab $silver you’re getting every instance of the group. So you have an array of arrays with the fields as indexes. So the first name would be $silver[0]['sponsor_silver_name']. You’ll have to be creative to determine if there are any silver groups as they may have an empty first. So something like the following:

    function is_empty_group($group) {
      foreach($group as $item) {
        if ( $item['sponsor_silver_name'] ) {
          return false;
        }
      }
    
      return true;
    }
    
    // Then used as..
    $silver = get_post_meta($post->ID, 'summit_sponsor_silver_group', true);
    if ( is_empty_group($silver) ) {
    
    } else {
    
    }

    I strongly recommend taking the concept of what I’m doing here and forming your own solution rather than taking it directly. I’m just throwing this together conceptually. 🙂

    in reply to: Conditions when fields are empty #6325
    Jason
    Keymaster

    Can you please paste the field code? Is this an add-more field?

    in reply to: Conditions when fields are empty #6323
    Jason
    Keymaster

    Correct. When you have a group in Piklist there’s always going to be an array with the fields saved. So even thought we think of it as empty, it’s still saving the fields as an array, albeit with empty values (or whatever the default value for the individual field is). So I’m assuming that to signify that there is no sponsor you’re simply leaving the group empty, in which case you have to determine which field in the group is how you’d determine that and check whether that field is empty.

    Another option I’ve used is to have a radio field that has a title such as “Has a sponsor”, and the values “Yes” and “No”. Then conditionally show/hide the group based on that radio. Then you would check against the radio button to determine if there is or isn’t a sponsor.

    in reply to: Conditions when fields are empty #6321
    Jason
    Keymaster

    Hey @4michaelcoleman!

    Gotcha. I had a feeling that was the structure. So the reason that empty($silver) doesn’t work is because even if the fields are empty, it’s still an array with those indexes. So you may want to consider which field is required minimally. So if it’s sponsor_silver_name, then use empty($silver['sponsor_silver_name']).

    Make sense?

    in reply to: Conditions when fields are empty #6318
    Jason
    Keymaster

    It’s hard to say. If I had to guess I’d say the value of $silver probably isn’t what your expecting, which is why I suggest doing something like:

    <?php
    $silver = get_post_meta($post->ID, 'summit_sponsor_silver_group', true);
    print_r($silver);
    in reply to: piklist_add_meta_box $data array format #6304
    Jason
    Keymaster

    Hi @cdcorey!

    My apologies for the lack of documentation. We’re putting our effort into making a new and improve documentation site.

    From 0.9.9.7 on you can use the piklist_part_process hook. The first parameter is the part that you’ll be changing the post types for, and the second parameter is the folder the part is in (e.g. metabox, settings, etc.). If you like looking at source code to learn more, check out the process_parts function in the piklist/includes/class-piklist.php file.

    Hope this helps! 🙂

    in reply to: Trying to get all categories that has linked posts #6303
    Jason
    Keymaster

    Hi @cannect!

    I have to ask this first, since you’re calling it a category, would it not work better to be a taxonomy rather than a post type?

    So if I understand correctly, you’re trying to get every project_category post that is related to a project?

    in reply to: Conditions when fields are empty #6302
    Jason
    Keymaster

    Hi @4michaelcoleman!

    What’s the value of $silver? Have you tried something like print_r($silver) to see its value?

    in reply to: Minor bug with PHP 7 (E_DEPRECATED) #6301
    Jason
    Keymaster

    Hi! I assume you’re not using the trunk version of Piklist? This should be fixed in the latest trunk version.

    Thanks for reporting this!

    in reply to: Add custom column in post type edit grid #6289
    Jason
    Keymaster

    Hi @acrassy!

    This isn’t built into Piklist core yet, and I’m not sure how Piklist would do much more than make the configuration a bit different. Using the hooks WordPress currently provides is actually pretty easy. You just use one hook to add the column, and another to provide the value for each post within the column. They actually did a pretty good job making columns easy to manage. If you need anything complicated (a computed value, conditional, etc.) then that’s the way to go. If it’s pretty simple, then you could just use the plugin suggested above, providing the same field name as you used in Piklist.

    Hope this helps! 🙂

Viewing 15 posts - 136 through 150 (of 330 total)