Last active
August 29, 2016 23:17
-
-
Save fatihtoprak/44a58ee10ee296742e059375fe2c6962 to your computer and use it in GitHub Desktop.
medium-transient-api_exaple.php
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
| <?php | |
| $transName = 'sonon-yazi'; | |
| $cacheTime = 10; //Zaman aralığı | |
| if(false === ($prepared = get_transient($transName) ) ){ | |
| global $wpdb; | |
| $prepared = $wpdb->prepare("SELECT ID, post_title FROM $wpdb->posts WHERE `post_status` = 'publish' AND `post_type` = 'post' AND LIMIT 10 ); | |
| set_transient($transName, $prepared, 60 * $cacheTime); | |
| } | |
| ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment