Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //For WordPress › Plugin › [Random Text] Version: 0.2.9
- // On randomtext.php add the following code on line 198 below add_shortcode('randomtext', 'randomtext_shortcode');"
- //You can use shortcodes <strong>[alltext]</strong> or <strong>[alltext category="funny"]</strong>
- // webgeeking.com - Shortcode implementation to display all
- function alltext_shortcode($attribs) {
- extract(shortcode_atts(array('category' => '', ), $attribs));
- global $wpdb;
- $table_name = $wpdb->prefix . 'randomtext';
- $sql = 'SELECT randomtext_id, text FROM '. $table_name." WHERE visible='yes' ";
- $sql .= ($category!='') ? " AND category = '$category'" : '' ;
- $sql .= ' ORDER BY randomtext_id asc';
- $rows = $wpdb->get_results($sql);
- $item_count = $wpdb->get_row("Select count(*) items FROM $table_name $where");
- $totalrows = $item_count->items;
- $display = '';
- foreach($rows as $row) {
- $display .= do_shortcode($row->text) ;
- $display .= '<br /> <br />';
- }
- return $display;
- }
- add_shortcode('alltext', 'alltext_shortcode');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement