Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

merge

  • Loading branch information...
commit b934ed3487b8675b9ab6ad73426d7a014cb0a5f1 2 parents 9e77a1f + 0618ca6
@alexanmtz authored
Showing with 10 additions and 27 deletions.
  1. +0 −11 readme.txt
  2. +10 −16 wp-agenda.php
View
11 readme.txt
@@ -42,7 +42,6 @@ e.g.
Once the event is created, you can acessing http://yoursite/?agenda=show for see the full calendar of events, or even http://yoursite/?post_type=agenda for see the events lists.
== Screenshots ==
-<<<<<<< HEAD
1. `/trunk/screenshot1.png`
2. `/trunk/screenshot2.png`
@@ -61,23 +60,13 @@ Once the event is created, you can acessing http://yoursite/?agenda=show for see
7. New option at admin
8. The calendar page
-== Frequently Asked Questions ==
-
-= What's the different from others great Agenda Plugins out there? =
-
-Well, my motivation to write this plugin is to use the new post-type introduced at version 3.0. This way I could use the wordpress post system to handler events as posts, and this way be categorized and treated as posts. Another thing is that I was wishing some flexible with the layout, so you can use a agenda template in your theme and it will be loaded!.
->>>>>>> svn
== Frequently Asked Questions ==
-<<<<<<< HEAD
= What's the different from others great Agenda Plugins out there? =
Well, my motivation to write this plugin is to use the new post-type introduced at version 3.0. This way I could use the wordpress post system to handler events as posts, and this way be categorized and treated as posts. Another thing is that I was wishing some flexible with the layout, so you can use a agenda template in your theme and it will be loaded!.
== Changelog ==
-=======
->>>>>>> svn
-= 1.0 =
* first release. Rewriting the old wp-agenda from funarte website to a new post-type
View
26 wp-agenda.php
@@ -35,7 +35,7 @@ function register_admin_scripts() {
wp_enqueue_script( 'dateformat', PLUGIN_PATH.'/js/dateformat.js');
wp_enqueue_script( 'blockui', PLUGIN_PATH.'/js/jquery.blockui.js', array('jquery'));
wp_enqueue_script( 'validate', PLUGIN_PATH.'/js/jquery.validate.min.js', array('jquery'));
- wp_enqueue_script( 'agenda', PLUGIN_PATH.'/js/agenda_admin.js', array('fullcalendar','jquery-ui-dialog'));
+ wp_enqueue_script( 'agenda', PLUGIN_PATH.'/js/agenda_admin.js', array('fullcalendar','jquery-ui-dialog', 'jquery-ui-datepicker'));
}
function register_public_scripts() {
@@ -59,9 +59,8 @@ function register_actions() {
add_action('wp_print_scripts', array($this,'generate_javascript_object'));
/* reescrevendo url */
- add_action('generate_rewrite_rules', array($this,'agenda_add_rewrite_rules'));
/* aplicando urls */
- add_action('init', array($this,'agenda_flush_rewrite_rules'));
+ add_action('init', array($this,'agenda_rewrite_rules'));
/* redirecionando template */
add_action("template_redirect",array($this,'agenda_templates'));
/* passando variaveis para o loop de agenda */
@@ -85,13 +84,16 @@ function register_ajax_actions() {
function get_agenda_events() {
global $wpdb;
$events = get_posts(array('post_type'=>'agenda', 'numberposts' => -1), ARRAY_A);
+ if( current_theme_supports( 'post-thumbnail' ) ) {
+ $thumb = get_the_post_thumbnail( $event->ID, array(100,100) );
+ }
foreach($events as $event) {
$event->start_date = get_post_meta($event->ID, 'start-date');
$event->end_date = get_post_meta($event->ID, 'end-date');
$event->start_time = get_post_meta($event->ID, 'start-time');
$event->end_time = get_post_meta($event->ID, 'end-time');
- $event->thumbnail = get_the_post_thumbnail( $event->ID, array(100,100) );
+ $event->thumbnail = $thumb;
}
$json = json_encode($events);
echo $json;
@@ -193,21 +195,13 @@ function save_metadata($id) {
return $metadata;
}
- function agenda_add_rewrite_rules($wp_rewrite) {
- $new_rules = Array();
- $new_rules['agenda/?$'] = 'index.php?post_type=agenda';
- $new_rules['agenda/?$'] = 'index.php?agenda=show';
- $wp_rewrite->rules = $new_rules + $wp_rewrite->rules;
- }
-
- function agenda_flush_rewrite_rules() {
- global $wp_rewrite;
- $wp_rewrite->flush_rules();
+ function agenda_rewrite_rules() {
+ add_rewrite_tag('%agenda%','([^&]+)');
}
function agenda_templates() {
-
- if ( $_GET['agenda'] == 'show' ) {
+ global $wp_query;
+ if ( !is_null($wp_query->query_vars['agenda']) ) {
if (file_exists(TEMPLATEPATH . '/agenda.php')) {
include(TEMPLATEPATH . '/agenda.php');
exit;
Please sign in to comment.
Something went wrong with that request. Please try again.