WordPress.org

Plugin Directory

Changeset 484476


Ignore:
Timestamp:
01/04/12 13:23:49 (2 years ago)
Author:
GeertDD
Message:

Working on v0.3

Location:
speedy-page-redirect/trunk
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • speedy-page-redirect/trunk/readme.txt

    r394923 r484476  
    33Tags: redirect, redirection, forward, url, 301, 302 
    44Requires at least: 3.0 
    5 Tested up to: 3.1.2 
    6 Stable tag: 0.2.1 
     5Tested up to: 3.2.1 
     6Stable tag: 0.3 
    77 
    88Redirect pages and posts to other locations. 
     
    1313 
    1414= Features = 
    15 * Choose between permanent and temporary redirects. 
     15* Choose between permanent (301) and temporary (302) redirects. 
    1616* Support for custom post types out of the box. 
     17* Filters for customizing some settings. 
    1718* Compatible with WP Multisite. 
    1819* Fully translatable. Included languages: English, Dutch. 
     
    23241. Activate the plugin through the “Plugins” menu in WordPress. 
    2425 
     26== Frequently Asked Questions == 
     27 
     28= Can you create redirects relative to the site's URL? = 
     29 
     30Yes. In the “Destination URL” field, just start your URL with a forward slash instead of “http://”. The site address, set in Settings > General, will automatically be prepended. 
     31 
     32= Is it possible to choose which post types Speedy Page Redirect applies to? = 
     33 
     34Yes. By default “page”, “post” and all public custom post types are taken into account. You can customize this selection via the `gdd_spr_post_types` filter. It should return an array with the applicable post types. 
     35 
     36Example: 
     37 
     38`add_filter('gdd_spr_post_types', 'gdd_spr_post_types'); 
     39function gdd_spr_post_types($post_types) 
     40{ 
     41    // Disable redirection for the "book" post type 
     42    unset($post_types['book']); 
     43    return $post_types; 
     44}` 
     45 
     46= Is it possible to customize the types of HTTP redirects to choose from? = 
     47 
     48Yes. By default you can choose from a 301 (permanent) and 302 (temporary) redirect. To customize this list, a filter called `gdd_spr_statuses` is available. It should return an array with the keys corresponding to the HTTP response codes. The array values are descriptions used in the dropdown list. 
     49 
     50Note: if the statuses list only contains a single entry, the dropdown list is automatically omitted from the meta box. 
     51 
     52Example: 
     53 
     54`add_filter('gdd_spr_statuses', 'gdd_spr_statuses'); 
     55function gdd_spr_statuses($statuses) 
     56{ 
     57    // Remove temporary redirection from the list 
     58    unset($statuses[302]); 
     59    return $statuses; 
     60}` 
     61 
    2562== Screenshots == 
    2663 
     
    2865 
    2966== Changelog == 
     67 
     68= 0.3 = 
     69* Uninstalling now removes all plugin data from the database. 
     70* Expanded documentation/FAQ. 
     71* Hide redirection dropdown list if only a single option is available. 
     72* First entry in the statuses list will be used as default redirection type. 
    3073 
    3174= 0.2.1 = 
  • speedy-page-redirect/trunk/speedy-page-redirect.php

    r394923 r484476  
    44Plugin URI: http://wordpress.org/extend/plugins/speedy-page-redirect/ 
    55Description: Redirect pages and posts to other locations. 
    6 Version: 0.2.1 
     6Version: 0.3 
    77Author: Geert De Deckere 
    88Author URI: http://www.geertdedeckere.be/ 
     
    3636     * @var string 
    3737     */ 
    38     const VERSION = '0.2.1'; 
     38    const VERSION = '0.3'; 
    3939 
    4040    /** 
     
    100100 
    101101        // Automatically include all public custom post types 
    102         $this->post_types = array_merge(array('page', 'post'), get_post_types(array('_builtin' => FALSE))); 
     102        $this->post_types = array_merge(array('page' => 'page', 'post' => 'post'), get_post_types(array('_builtin' => FALSE))); 
    103103 
    104104        // Allow user to modify the post types 
     
    192192 
    193193        // Output the redirection type select list if needed 
    194         if ( ! empty($this->statuses)) 
     194        if (count($this->statuses) > 1) 
    195195        { 
    196196            echo '<p>'; 
     
    228228            // Prepare data array to store in the database 
    229229            $data['url'] = esc_url_raw($url); 
    230             $data['status'] = 301; 
     230            // Grab first status key from the list by default 
     231            $data['status'] = (int) key($this->statuses); 
     232            $data['status'] = ( ! empty($data['status'])) ? $data['status'] : 301; 
    231233 
    232234            // Overwrite the default status with the selected one if any 
Note: See TracChangeset for help on using the changeset viewer.