Outil de recherche WordPress pour les développeurs et auteurs de thèmes

jQuery wpseek API plugin

This jQuery plugin is designed to ease the use to request the API and its methods.



Download



Installation

Include jQuery library and plugin file:

<script type="text/javascript" src="jquery.min.js"></script>
<script type="text/javascript" src="jquery.wpseek.min.js"></script>


Usage / Available Methods

jQuery(document).ready(function() {
	jQuery.wpseek.Method({ [params] }, callback);
	
	jQuery.wpseek.getInfo({ foo: "bar" }, callback);
	jQuery.wpseek.getFunction({ s: "get_bloginfo" }, callback);
	jQuery.wpseek.getSimilar({ s: "get_", limit: 4 }, callback);
	jQuery.wpseek.getTopics({ s: "get_bloginfo", limit: 4 }, callback);
});


Usage Examples

jQuery.wpseek.getInfo

<script type="text/javascript">
jQuery(document).ready(function() {
	jQuery('#clck_getinfo').click(function() {
		jQuery.wpseek.getInfo({ foo: "bar" }, function( wp ) {
			jQuery('#clck_getinfo').replaceWith('The current version of WordPress is <a href="' + wp.infoURI + '">' + wp.version + ' and can be downloaded <a href="' + wp.downloadURI + '">here</a>.');
		});
	});
});
</script>
<a href="javascript:void(0)" id="clck_getinfo">Get info about the latest WordPress release</a>

Demo:
Get info about the latest WordPress release

jQuery.wpseek.getFunction

<script type="text/javascript">
jQuery(document).ready(function() {
	jQuery('#clck_getfunction').click(function() {
		jQuery.wpseek.getFunction({ s: "get_bloginfo_rss" }, function( wp ) {
			if( wp.status == 'error' ) {
				jQuery('#clck_getfunction').replaceWith( wp.message );
				return;
			}
			jQuery('#clck_getfunction').replaceWith(wp.name + ' is a ' + wp.type + ' that was introduced in WordPress ' + wp.introducedVer + '. Codex Page can be found <a hreF="' + wp.codexURI + '">here.');
		});
	});
});
</script>
<a href="javascript:void(0)" id="clck_getfunction">Get info about 'get_bloginfo_rss' function</a>

Demo:
Get info about 'get_bloginfo_rss' function

jQuery.wpseek.getSimilar

<script type="text/javascript">
jQuery(document).ready(function() {
	jQuery('#clck_getsimilar').click(function() {
		jQuery.wpseek.getSimilar({ s: "get_", limit: 4 }, function( wp ) {
			if( wp.status == 'ok' ) {
				jQuery('#clck_getsimilar').html('');
				jQuery.each(wp.items, function(i,item) {
            		jQuery('#wpssimilar').append('' + item.name + ' (' + item.type + ')
'); }); } }); }); }); </script> <a href="javascript:void(0)" id="clck_getsimilar">Get 4 suggested functions for 'get_'</a> <div id="wpssimilar"></div>

Demo:
Get 4 suggested functions for 'get_'



jQuery.wpseek.getTopics

<script type="text/javascript">
jQuery(document).ready(function() {
	jQuery('#clck_gettopics').click(function() {
		jQuery.wpseek.getTopics({ s: "get_bloginfo", limit: 4 }, function( wp ) {
			if( wp.status == 'ok' ) {
				jQuery('#clck_gettopics').html('');
				jQuery.each(wp.items, function(i,item) {
            		jQuery('#wpstopics').append('<a href="' + item.link + '">' + item.title + '</a><br />');
          		});
			}
		});
	});
});

<a href="javascript:void(0)" id="clck_gettopics">Get 5 most recent forum topics for 'get_bloginfo'</a>
<div id="wpstopics"></div>

Demo:
Get 5 most recent forum topics for 'get_bloginfo'