From 2317bb99cf0f8d93b77764ac7269d05dba8e9470 Mon Sep 17 00:00:00 2001 From: Felipe Pasquali Date: Fri, 14 Sep 2012 14:25:55 -0300 Subject: [PATCH] Repositorio criado e arquivos adicionados --- wp-oquegd-custom_metabox.php | 50 +++++++++++ wp-oquegd-custom_post.php | 41 +++++++++ wp-oquegd-custom_taxonomy.php | 3 + wp-oquegd-plugin.php | 52 +++++++++++ wp-oquegd-widget.php | 159 ++++++++++++++++++++++++++++++++++ 5 files changed, 305 insertions(+) create mode 100644 wp-oquegd-custom_metabox.php create mode 100644 wp-oquegd-custom_post.php create mode 100644 wp-oquegd-custom_taxonomy.php create mode 100644 wp-oquegd-plugin.php create mode 100644 wp-oquegd-widget.php diff --git a/wp-oquegd-custom_metabox.php b/wp-oquegd-custom_metabox.php new file mode 100644 index 0000000..9e837ae --- /dev/null +++ b/wp-oquegd-custom_metabox.php @@ -0,0 +1,50 @@ + $prefix.'info_geral', + 'title' => 'Informações Gerais', + 'pages' => array('oquegd_oque'), + 'context'=> 'normal', + 'priority'=> 'high', + 'fields' => array( + array( + 'name' => 'Screenshots (plupload)', + 'desc' => 'Screenshots of problems, warnings, etc.', + 'id' => $prefix . 'screenshot2', + 'type' => 'plupload_image', + 'max_file_uploads' => 4, + ), + array( + 'name' => 'Screenshots (thickbox upload)', + 'desc' => 'Screenshots of problems, warnings, etc.', + 'id' => $prefix . 'screenshot3', + 'type' => 'thickbox_image', + ) + ) +); + + +function wp_oquegd_register_meta_boxes() +{ + global $meta_boxes_oquegd; + + if ( class_exists( 'RW_Meta_Box' ) ) + { + foreach ( $meta_boxes_oquegd as $meta_box ) + { + new RW_Meta_Box( $meta_box ); + } + } +} + +add_action('admin_init', 'wp_oquegd_register_meta_boxes' ); +*/ + +?> \ No newline at end of file diff --git a/wp-oquegd-custom_post.php b/wp-oquegd-custom_post.php new file mode 100644 index 0000000..6b33028 --- /dev/null +++ b/wp-oquegd-custom_post.php @@ -0,0 +1,41 @@ + _x( 'O que é?', 'oque' ), + 'singular_name' => _x( 'Documento', 'oque' ), + 'add_new' => _x( 'Novo Documento', 'oque' ), + 'all_items' => _x('Documentos', 'oque'), + 'add_new_item' => _x( 'Adicionar Novo Documento', 'oque' ), + 'edit_item' => _x( 'Editar Documento', 'oque' ), + 'new_item' => _x( 'Novo Documento', 'oque' ), + 'view_item' => _x( 'Visualizar Documento', 'oque' ), + 'search_items' => _x( 'Pesquisar Documento', 'oque' ), + 'not_found' => _x( 'Nenhum documento encontrado', 'oque' ), + 'not_found_in_trash' => _x( 'Nenhum documento encontrado na lixeira', 'oque' ), + 'parent_item_colon' => _x( 'Documento pai:', 'oque' ), + 'menu_name' => _x( 'O que é?', 'oque'), + ); + $args = array( + 'labels' => $labels, + 'hierarchical' => false, + 'supports' => array( 'title', 'editor', 'author', 'comments', 'revisions'), + 'public' => true, + 'show_ui' => true, + 'show_in_menu' => true, + 'menu_position' => 80, + 'show_in_nav_menus' => true, + 'publicly_queryable' => true, + 'exclude_from_search' => false, + 'has_archive' => true, + 'query_var' => true, + 'can_export' => true, + 'rewrite' => true, + 'capability_type' => 'post' + ); + register_post_type( 'oquegd_oque', $args ); +} + +add_action( 'init', 'wp_oquegd_oque' ); + +?> \ No newline at end of file diff --git a/wp-oquegd-custom_taxonomy.php b/wp-oquegd-custom_taxonomy.php new file mode 100644 index 0000000..15c5adc --- /dev/null +++ b/wp-oquegd-custom_taxonomy.php @@ -0,0 +1,3 @@ + \ No newline at end of file diff --git a/wp-oquegd-plugin.php b/wp-oquegd-plugin.php new file mode 100644 index 0000000..d6f1d26 --- /dev/null +++ b/wp-oquegd-plugin.php @@ -0,0 +1,52 @@ + diff --git a/wp-oquegd-widget.php b/wp-oquegd-widget.php new file mode 100644 index 0000000..92d0285 --- /dev/null +++ b/wp-oquegd-widget.php @@ -0,0 +1,159 @@ + 'OqueListaWidget', 'description' => 'O que é? Gabinete Digital. Lista de documentos O que é?' ); + $this->WP_Widget('OqueListaWidget', 'Gabinete Digital - O que é?', $widget_ops); + } + + function form($instance) + { + $instance = wp_parse_args( (array) $instance, array( 'titulo' => '', 'colunas' => '3', 'qtd' => '5', 'css_class' => '' ) ); + $titulo = $instance['titulo']; + $colunas = $instance['colunas']; + $qtd = $instance['qtd']; + $css_class = $instance['css_class']; + + ?> +

+

+

+

+
"; + + echo $before_title . $titulo . $after_title;; + + if (!empty($qtd)) + $args_query_post = $args_query_post . "posts_per_page=" . $qtd; + + if (!empty($custom_post)) + { + if ($args_query_post == '') + $args_query_post = $args_query_post . "post_type=" . $custom_post; + else + $args_query_post = $args_query_post . "&post_type=" . $custom_post; + } + + query_posts($args_query_post); + if (have_posts()) : + echo ""; + endif; + wp_reset_query(); + + echo "
"; + } + +} +add_action( 'widgets_init', create_function('', 'return register_widget("OqueListaWidget");') ); + + +class OqueWidget extends WP_Widget +{ + function OqueWidget() + { + $widget_ops = array('classname' => 'OqueWidget', 'description' => 'O que é? Gabinete Digital. Documento unico O que é?' ); + $this->WP_Widget('OqueWidget', 'Gabinete Digital - O que é?', $widget_ops); + } + + function form($instance) + { + $instance = wp_parse_args( (array) $instance, array( 'titulo' => '', 'post_id' => '', 'colunas' => '3', 'css_class' => '' ) ); + $titulo = $instance['titulo']; + $post_id = $instance['post_id']; + $colunas = $instance['colunas']; + $css_class = $instance['css_class']; + + ?> +

+

+

+

+
"; + + echo $before_title . $titulo . $after_title;; + + if (!empty($post_id)) + $args_query_post = $args_query_post . "p=" . $post_id; + + if (!empty($custom_post)) + { + if ($args_query_post == '') + $args_query_post = $args_query_post . "post_type=" . $custom_post; + else + $args_query_post = $args_query_post . "&post_type=" . $custom_post; + } + + query_posts($args_query_post); + if (have_posts()) : + echo ""; + endif; + wp_reset_query(); + + echo "
"; + } + +} +add_action( 'widgets_init', create_function('', 'return register_widget("OqueWidget");') ); + + +?> \ No newline at end of file