123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- <?php
- if (!class_exists("plug_post_thumbs")) {
- class plug_post_thumbs {
- function plug_post_thumbs($ns) {
- $this->title = __("Admin post thumbs","dagsopt");
- $this->pluginname = $ns->pluginname;
- $this->file = $ns->file;
- $this->ns = $ns;
- add_image_size( 'admin-list-thumb', get_option($this->pluginname.'_post_thumbs_width',100 ), get_option($this->pluginname.'_post_thumbs_height',100 ), false );
- add_theme_support( 'post-thumbnails' );
-
- }
- function start(){
- add_filter('manage_posts_columns', array(&$this,'tcb_add_post_thumbnail_column'), 5);
- add_filter('manage_pages_columns', array(&$this,'tcb_add_post_thumbnail_column'), 5);
- add_action('manage_posts_custom_column', array(&$this,'tcb_display_post_thumbnail_column'), 5, 2);
- add_action('manage_pages_custom_column', array(&$this,'tcb_display_post_thumbnail_column'), 5, 2);
-
- }
-
-
-
-
- function tcb_add_post_thumbnail_column($cols){
- $cols['tcb_post_thumb'] = __('Featured','dagsopt');
- return $cols;
- }
-
- function tcb_display_post_thumbnail_column($col, $id){
- switch($col){
- case 'tcb_post_thumb':
- if( function_exists('the_post_thumbnail') )
- echo the_post_thumbnail( 'admin-list-thumb' );
- else
- echo 'Not supported in theme';
- break;
- }
- }
-
- function Option($pre){
- update_option ( $pre.'_width', $_POST [ $pre.'_width' ] );
- update_option ( $pre.'_height', $_POST [ $pre.'_height' ] );
-
- }
-
- function admin_line($pre){
- ?>
- <table>
- <tr><td><?php echo(__("Width:","dagsopt")) ?></td><td><input type="text" name="<?php echo( $pre.'_width' ) ?>" value="<?php echo( get_option( $pre.'_width',100 ) ) ?>"></td></tr>
- <tr><td><?php echo(__("Height:","dagsopt")) ?></td><td><input type="text" name="<?php echo( $pre.'_height' ) ?>" value="<?php echo( get_option( $pre.'_height',100 ) ) ?>"></td></tr>
- </table>
-
- <?php
- }
- }
- /*
- function example_dashboard_widget_function() {
- echo "Hello World, I'm a great Dashboard Widget";
- }
- function example_add_dashboard_widgets() {
- wp_add_dashboard_widget('example_dashboard_widget', 'Example Dashboard Widget', 'example_dashboard_widget_function');
- }
- add_action('wp_dashboard_setup', 'example_add_dashboard_widgets' );
- */
- global $plug_post_thumbs;
- $plug_post_thumbs = new plug_post_thumbs($this);
- $this->dagsopt['plug_post_thumbs'] = $plug_post_thumbs;
-
- }
|