Making WordPress.org

Changeset 3958


Ignore:
Timestamp:
09/05/2016 06:09:42 PM (10 years ago)
Author:
kovshenin
Message:

WordCamp Post Type: Add a new /info/ endpoint to the post type.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordcamp.org/public_html/wp-content/plugins/wcpt/wcpt-wordcamp/wordcamp-loader.php

    r3833 r3958  
    2727                add_filter( 'pre_get_posts',       array( $this, 'query_public_statuses_on_archives' ) );
    2828                add_action( 'wp_insert_post_data', array( $this, 'set_scheduled_date'                ) );
     29                add_filter( 'wordcamp_rewrite_rules', array( $this, 'wordcamp_rewrite_rules' ) );
    2930        }
    3031
    … …  
    357358                return $transitions[ $status ];
    358359        }
     360
     361        /**
     362         * Additional rules for the WordCamp post type.
     363         *
     364         * @param array $rules Rewrite rules.
     365         *
     366         * @return array The final rewrite rules.
     367         */
     368        public function wordcamp_rewrite_rules( $rules ) {
     369                $rules = array( 'wordcamps/([^/]+)/info/?$' => 'index.php?wordcamp=$matches[1]&wcorg-wordcamp-info=1' ) + $rules;
     370                return $rules;
     371        }
    359372}
    360373
Note: See TracChangeset for help on using the changeset viewer.