Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- Plugin Name: Recent Videos
- Plugin URI: http://localblog
- Description: Displays Simple Video Embedder videos
- Author: Matthew Smith
- Version: 1
- Author URI: http://localblog
- */
- function mbrecentvids()
- { ?>
- <?php
- $querydetails = "
- SELECT wposts.*
- FROM $wpdb->posts wposts, $wpdb->postmeta wpostmeta
- WHERE wposts.ID = wpostmeta.post_id
- AND wpostmeta.meta_key = '_videoembed'
- AND wposts.post_status = 'publish'
- AND wposts.post_type = 'post'
- ORDER BY wposts.post_date DESC
- LIMIT 6
- ";
- $pageposts = $wpdb->get_results($querydetails, OBJECT_K)
- ?>
- <?php if ($pageposts):
- foreach ($pageposts as $post):
- setup_postdata($post); ?>
- <p>
- <a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title?>"><?php the_title(); ?></a>
- </p>
- <?php endforeach;
- endif; ?>
- <?php
- }
- function widget_myHelloWorld() {
- ?>
- <h3>Latest Videos</h3>
- <?php mbrecentvids(); ?>
- <?php
- }
- function mblatestvids_init()
- {
- register_sidebar_widget(__('Latest Videos'), 'widget_myHelloWorld');
- }
- add_action("plugins_loaded", "mblatestvids_init");
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement