Created
August 2, 2016 10:47
-
-
Save plewick/fa82e2189885e543bb8bfbcfe87947b0 to your computer and use it in GitHub Desktop.
Simple wordpress PHP function for lorem impum shortcode generated from http://www.lipsum.com/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function lipsum_shc() { | |
| ob_start(); | |
| $url = 'http://www.lipsum.com/feed/json'; | |
| $content = file_get_contents($url); | |
| $json = json_decode($content, true); | |
| foreach($json as $i){ | |
| echo wpautop($i['lipsum']); | |
| } | |
| return ob_get_clean(); | |
| } | |
| add_shortcode( 'lipsum', 'lipsum_shc' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment