oEmbed Call

The Oembed Call

Spanish Quote of the Day works via an unique oembed call (see http://http://www.oembed.com/ for further information) to the quotes database of http://todopensamientos.com so the plugin it’s fast, secure, simple and… automatic.

In the first step, the oembed call to the address http://todopensamientos.com/oembed/ –the Todopensamientos API endpoint– is made using the WP function wp_remote_post() with the default WP configuration (For further information, please see the official documentation about the function wp_remote_post).

In the second step, Todopensamientos database returns an HTTP response that the plugin transforms for extracting the standard oEmbed json response object using the WP function wp_remote_retrieve_body(). This is an example of the standard todopensamientos oEmbed response.

(object) $response  {
        "version":"1.0",
        "type":"rich",
        "html": the quote contents,
        "url":  exact URL's quote, 
        "provider_name": "TodoPensamientos",
        "provider_url":  URL's provider,
        "author_name": Author name,
        "author_url": exact URL's author name archive of quotes,
    }

And then the plugin creates the first output that’s given to you via the first filter raw_quotes as a PHP object array so, if you need a deep and sophisticated control of the oembed object $response, you must directly use this first filter (it’s possible, but not recommended in any case).

Finally, in the third step, the plugin processes the object response and gives you a processed output to screen converting the PHP object array in an HTML string that’s served for both widget and shortcode uses via the widget_quotes filter and post_quotes filters, respectively.

Install Now

DemoDownload NowWordPress plugin pageImprove your themes, install now Spanish Quote of the Day.