Any idea ? I know this is related to WP_Query but… well I need help for a correct syntax.
Do you mean when you’re editing a post and then in the select post-popup you want only sub pages of the posts that you’re editing to show up?
I was trying to find some documentation on this too – I couldn’t. So then I found the error in the code. The additional parameters aren’t being passed.
In scripts.js I’ve added the code that seems to get this working. Hopefully this helps others get the the solution quicker – as well as it added into a future update.
Please note: I’ve only added 2 lines – this is mostly for reference.
// field type post
// popup a dialog where the user can choose the post to attach
$(document).on("click", "a.simple-fields-metabox-field-post-select", function(e) {
e.preventDefault();
var a = $(this);
// get post types to show
var div = a.closest(".simple-fields-metabox-field");
var enabled_post_types = div.find("input[name='simple-fields-metabox-field-post-enabled-post-types']").val();
var additional_args = div.find('input[name="additional_arguments"]').val();
$("div.simple-fields-meta-box-field-group-field-type-post-dialog").data("originLink", this).dialog({
width: 480,
height: 'auto',
modal: true,
dialogClass: 'wp-dialog',
zIndex: 300000,
open: function(event, ui) {
var originLink = $($(this).data("originLink"));
arr_enabled_post_types = enabled_post_types.split(",");
$(this).text("Loading...").load(ajaxurl, {
"action": "simple_fields_field_type_post_dialog_load",
"arr_enabled_post_types": arr_enabled_post_types,
"additional_arguments" : additional_args
});
}
});
});
Thanks for digging into this and also for finding a solution. I’ll test this and hopefully it’s included in the next release.
I’m trying to do the same things with the bookmarks (fka blogroll).
As it’s part of the taxonomy now (the links categories), I try to call links from a category but links are not terms.
Is there a way to achieve that ?
This question was initially posted here
Thanks for your help.