Forum Replies Created
-
AuthorPosts
-
JasonKeymasterHey @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!
JasonKeymasterHey @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' => 12is full-width.Finally, for total customization, check out field templates.
Hope this helps!
May 4, 2016 at 2:13 pm in reply to: How can I get the ID of new post created by front-end form? #6429
JasonKeymasterGlad Kevin was able to clear it up. Thanks for posting the solution here!
May 3, 2016 at 10:58 am in reply to: How can I get the ID of new post created by front-end form? #6419
JasonKeymasterHi 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!
JasonKeymasterHi @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!
JasonKeymasterAh, gotcha. We ran into this in the other thread, too. When you grab
$silveryou’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. 🙂
JasonKeymasterCan you please paste the field code? Is this an add-more field?
JasonKeymasterCorrect. 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.
JasonKeymasterHey @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 useempty($silver['sponsor_silver_name']).Make sense?
JasonKeymasterIt’s hard to say. If I had to guess I’d say the value of
$silverprobably 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);
JasonKeymasterHi @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_processhook. 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! 🙂
JasonKeymasterHi @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?
JasonKeymasterHi @4michaelcoleman!
What’s the value of
$silver? Have you tried something likeprint_r($silver)to see its value?
JasonKeymasterHi! I assume you’re not using the trunk version of Piklist? This should be fixed in the latest trunk version.
Thanks for reporting this!
JasonKeymasterHi @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! 🙂
-
AuthorPosts