I am working on a plugin for Wordpress that get XML files from a FTP server and show them in separate widget (7 to be precise). My XML file represent category and each widget are name after those category.
They have multiple item in them and I have link a edit button on each one of them. When I click on the edit button it do a ajax call that get the title of the current item and return it to my post_item_function() as $title .
jQuery( '.putPending' ).live( 'click', function( ) {
var title = jQuery( this ).siblings( "h2" ).text( );
jQuery.ajax( {
url: ajaxurl,
datatype: 'json',
method: 'POST',
data:
{
action: 'ajax_fill_post',
title: title,
},
success: function( data )
{
var result = JSON.parse( data );
window.location.href = result.url;
}
});
});
This function take the $title and search on my selected XML file for the item with this title. When it does find it it select it and redirect the user to the edit post page where it fill it with the selected item.
What I want to know is can I get my current widget name by the same logic too? The way it currently work I need a foreach for each XML file and it's a lot of code but if I can get my widget name I could do it in a single foreach.
No comments:
Post a Comment