WordPress.org

Forums

Simple Fields
[resolved] Additional arguments (7 posts)

  1. sugardaddy
    Member
    Posted 2 years ago #

    I feel confuse when trying to use additional arguments for the post field.
    I'm trying to get only subpages of the current page (just to help my contributors) but none of my different syntaxes seems to work...

    Any help is welcome !

    http://wordpress.org/extend/plugins/simple-fields/

  2. sugardaddy
    Member
    Posted 2 years ago #

    Any idea ? I know this is related to WP_Query but... well I need help for a correct syntax.

  3. Pär Thernström
    Member
    Plugin Author

    Posted 2 years ago #

    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?

  4. sugardaddy
    Member
    Posted 2 years ago #

    That's it !!

  5. mikevoermans
    Member
    Posted 2 years ago #

    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
    				});
    			}
    		});
    
    	});
  6. Pär Thernström
    Member
    Plugin Author

    Posted 2 years ago #

    Thanks for digging into this and also for finding a solution. I'll test this and hopefully it's included in the next release.

  7. sugardaddy
    Member
    Posted 1 year ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Simple Fields
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic