Forum Replies Created
-
AuthorPosts
-
June 15, 2016 at 12:10 pm in reply to: Notice: Undefined offset: 1 in post.php when Debug mode on #6688
JasonKeymasterGot it! The problem is that on some of the post types you’re setting
capability_typeas an array. As is standard with register_post_type, it either has to be a string or an array with pre-defined indexes. From the looks of it, if you just change, for example,array('invoice')to simply'invoice', that should fix the issue. But that depends on what you’re trying to do.June 15, 2016 at 11:34 am in reply to: Notice: Undefined offset: 1 in post.php when Debug mode on #6686
JasonKeymasterSorry, I don’t know the upload limits of this site. Hahah!
How about a gist, pastie, pastebin, etc.?
June 15, 2016 at 11:14 am in reply to: Notice: Undefined offset: 1 in post.php when Debug mode on #6682
JasonKeymasterHi @vayu!
Thanks! That helps!
Are you registering any custom post types via the
piklist_post_typeshook? If so could you show me the code for that? Either you’ve found a bug or there’s a simple misconfiguration.June 15, 2016 at 11:00 am in reply to: Trying to get property of non-object (Clean install) when adding CPT #6681
JasonKeymasterHey @jivedig!
Interesting. The
touch_timefunction isn’t used by a theme; it’s an admin-side function, so changing themes (as you found) wouldn’t have any affect. Still, I just tried this out locally and I’m not having the same issue. Perhaps something is misconfigured where you’re defining the post type?Have you tried debugging the line in template.php to see if you can get more information on the variable that’s supposed to be an object?
June 15, 2016 at 10:49 am in reply to: Notice: Undefined offset: 1 in post.php when Debug mode on #6678
JasonKeymasterHi @vayu!
Most times in these situations it’s something using Piklist that’s misconfigured that’s causing the issue. Using the piklist function incorrectly, on accident, for example, can raise an error that looks like it’s Piklist having an issue.
In any case, could you please provide a stack trace to try and isolate the culprit line of code?
JasonKeymasterAlso, keep in mind that you don’t need the
'field'parameter to the field if you’re using it for relationships.June 8, 2016 at 12:07 pm in reply to: Function to programatically save add-more field values in settings? #6631
JasonKeymasterHi @stham!
You would probably want to use the register_activation_hook instead of
admin_init, otherwise you’ll be updating the settings every time the admin-side loads. Also, check to make sure there isn’t an existing value or you’ll overwrite what they’ve done if the plugin is deactivated and reactivated.That said, using
update_optionshould work just fine. Just make sure you’re using the right options key and saving in the format Piklist is expecting. I’d enter the values through the field, save it, then check out the wp_options table to see how Piklist is saving it out. It may either be a single, serialized row, or multiple rows per value (depending on whether it’s a group or not).That should work. Piklist isn’t doing anything magical beyond the normal use of
get_optionandupdate_option.
JasonKeymasterHi @bicho44!
Piklist makes it easy to quickly make metaboxes on the dashboard, but I’m afraid any interactivity you intend from there is up to you to develop. If I understand you correctly, you’ll probably be needing to do some admin-side ajax to accomplish what you’re looking for. For more information on how to do this, check out this article: https://codex.wordpress.org/AJAX_in_Plugins
JasonKeymasterThe difference between admin-side and front-end forms is that in the back-end the scope of the fields are derived from the context. For example if a field is on the post edit page, the fields assume they should save as the meta of that post. On the front end there’s no screen context, so it’s up to you to define both the scope and the object (if there is one).
Try setting
'scope' => 'post'.
JasonKeymasterHmm.. I’m using 0.9.9.9. I’m not aware of any fix for this, but it’s possible.
I haven’t tested the simpleton just yet, but I’m just using the default post type changing nothing about it but the name. I’ll try to look into this a bit more later. Unfortunately I’m in the middle of a very tight deadline.
JasonKeymasterInteresting, so, to be clear, low priority fields aren’t saving for the default post type? Are you using the latest trunk version of Piklist? I just tried to reproduce this locally and am unable to; it’s saving and updating just fine.
JasonKeymasterGlad to help! 🙂
JasonKeymasterYou actually don’t need a ‘field’ value at all for relate fields. The field is only used to provide a key for custom meta fields.
JasonKeymasterAh, I see. In the property_tenant field, you have
'relate' => array( 'scope' => 'tenants'when it should be'relate' => array( 'scope' => 'post'. The scope is to specify the object type (i.e. post, user, comment), not the post type. 😉As you can see, whatever is used there is later used in the
__relate_{$relate}meta key. -
AuthorPosts