Plugin Directory

Changeset 1507717


Ignore:
Timestamp:
10/03/2016 08:56:39 PM (9 years ago)
Author:
firebrandllc
Message:

Update to version 2.0.0 Add support for custom post types.

Location:
searchcloak/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • searchcloak/trunk/readme.txt

    r1398542 r1507717  
    44Tags: search, admin, google, cse
    55Requires at least: 3.2.1
    6 Tested up to: 4.5
    7 Stable tag: 1.3.2
     6Tested up to: 4.6.1
     7Stable tag: 2.0.0
    88License: GPLv2
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    6868
    6969= Does SearchCloak work with custom post types? =
    70 Not at this time. Plugins that create custom post types probably already include mechanisms for controlling visibility.
    71 If you'd like this plugin to work with custom post types, please leave a comment on the support thread.
     70Yes! As of version 2.0.0, SearchCloak lets you specify which Custom Post Types should get the SearchCloak checkboxes.
    7271
    7372== Screenshots ==
    74731. The SearchCloak box in Page editing.
    75 
     742. The SearchCloak dashboard settings page.
    7675
    7776== Changelog ==
     77= 2.0.0 =
     78Add support for custom post types
     79
    7880= 1.3.2 =
    7981Update testing information in documentation.
     
    9799== Upgrade Notice ==
    98100
    99 Version 1.1 added the ability to cloak regular Posts. Please upgrade.
     101Version 2.0.0 adds the ability to cloak Custom Post Types.
  • searchcloak/trunk/searchcloak.php

    r1398539 r1507717  
    22/**
    33 * @package searchcloak
    4  * @version 1.3.2
     4 * @version 2.0.0
    55 */
    66/*
     
    88Description: Allows Pages to be omitted from search results and search engine indexes
    99Author: Lon Koenig and Firebrand LLC
    10 Version: 1.3.2
     10Version: 2.0.0
    1111Author URI: http://firebrand.net/
    1212
     
    3535        'page' => 'edit_page',
    3636        // 'mycustomposttype' => 'edit_post'
    37     )
     37    ),
     38    'admin_page' => 'searchcloak', //'searchCloakPage',
     39    'op_name' => 'searchcloak_settings'
    3840);
    3941
     
    5153    global $searchcloak_settings;
    5254    $post_permissions = $searchcloak_settings['post_permissions'];
     55     // tack in the custom post types:
     56    $options = get_option( $searchcloak_settings['op_name'] );
     57    foreach($options as $k=>$v){ if ('on' == $v){$post_permissions[$k] = 'edit_post';}}
     58   
    5359    // step through all our supported post types and add a meta box
    5460    foreach (array_keys($post_permissions) as $post_type){
     
    106112        if (!empty($names) ) { $selected_option = $names[0]->slug; } // if there is a selection, use it
    107113        foreach ($tax_terms as $this_tax) {
     114        // maybe replace the following test with
     115        // 1) fetch post type info with get_post_types()
     116        // 2) check 'hierarchical'
    108117            if ( ('post' != $post->post_type) or (('post' == $post->post_type) and ('hidechildren' != $this_tax->slug) )){ // skip children option on 'post' pages
    109118                echo '<option class="searchcloak-option" value="' . $this_tax->slug  . '"';
     
    141150
    142151    global $searchcloak_settings;
     152
     153
    143154    $post_permissions = $searchcloak_settings['post_permissions'];
     155    // tack in the custom post types:
     156    $options = get_option( $searchcloak_settings['op_name'] );
     157    foreach($options as $k=>$v){ if ('on' == $v){$post_permissions[$k] = 'edit_post';}}
     158   
    144159    $retVal = $post_id; // return value for not allowed
    145160    if (array_key_exists('post_type', $_POST)){
     
    329344
    330345add_action('wp_head', 'searchcloak_noindex');
     346include_once('searchcloak_admin.php');
Note: See TracChangeset for help on using the changeset viewer.