Plugin Directory

Changeset 1708062


Ignore:
Timestamp:
08/03/2017 10:52:37 PM (9 years ago)
Author:
chrisb10
Message:

Added 4 new features

Location:
expand2017
Files:
3 added
4 edited

Legend:

Unmodified
Added
Removed
  • expand2017/trunk/expand2017.php

    r1705195 r1708062  
    44Plugin URI:    https://wordpress.org/plugins/expand2017/
    55Description:   Expand2017 adds new features to Automattic's Twenty Seventeen Theme
    6 Version:       1.2.0
     6Version:       1.3.0
    77Author:        chrisb10
    88Author URI:    https://profiles.wordpress.org/chrisb10/
    99*/
    1010
     11/* 1.0 - MAIN FEATURES */
     12
    1113// Change the default amount of sections
     14
     15add_filter( 'twentyseventeen_front_page_sections', 'expandts_custom_front_sections' );
    1216
    1317function expandts_custom_front_sections( $num_sections )
     
    1519        return 17; //Number of added sections
    1620    }
    17 add_filter( 'twentyseventeen_front_page_sections', 'expandts_custom_front_sections' );
    1821
    1922// If one result is found by the search results, redirect user to that post
    2023
    2124add_action('template_redirect', 'expandts_redirect_post');
     25
    2226function expandts_redirect_post() {
    2327    if (is_search()) {
     
    3236// Twitter mention link
    3337
     38add_filter('the_content', 'expandts_twitter_mention');   
     39add_filter('comment_text', 'expandts_twitter_mention');
     40
    3441function expandts_twitter_mention($content) {
    3542    return preg_replace('/([^a-zA-Z0-9-_&])@([0-9a-zA-Z_]+)/', "$1<a href=\"http://twitter.com/$2\" target=\"_blank\" rel=\"nofollow\">@$2</a>", $content);
    3643}
    3744
    38 add_filter('the_content', 'expandts_twitter_mention');   
    39 add_filter('comment_text', 'expandts_twitter_mention');
    40 
    4145// Coloured post types
    4246
    4347add_action('admin_footer','posts_status_color');
    44   function posts_status_color(){
     48
     49function posts_status_color(){
    4550?>
    4651<style>
     
    5560}
    5661.status-future {
    57     background: #ffe3ff !important;
     62    background: #f2fff9 !important;
    5863}
    5964.status-private
    6065{
    61     background: #f2fff9 !important;
     66    background: #ffe3ff !important;
    6267}
    6368</style>
     
    6671
    6772// Register User Contact Methods
     73
     74add_filter( 'user_contactmethods', 'expandts_custom_user_contact_methods' );
     75
    6876function expandts_custom_user_contact_methods( $user_contact_method ) {
    6977
     
    8088
    8189}
    82 add_filter( 'user_contactmethods', 'expandts_custom_user_contact_methods' );
    8390
    8491// Register scripts for dynamic menu system
     92
     93add_action( 'wp_enqueue_scripts', 'expandts_scripts_haze' );
    8594
    8695function expandts_scripts_haze()
     
    92101    wp_enqueue_script( 'expand2017' );
    93102}
    94 add_action( 'wp_enqueue_scripts', 'expandts_scripts_haze' );
     103
     104// Pretty search permalinks
     105
     106add_action( 'template_redirect', 'expandts_change_search_url_rewrite' );
     107
     108function expandts_change_search_url_rewrite() {
     109    if ( is_search() && ! empty( $_GET['s'] ) ) {
     110        wp_redirect( home_url( "/search/" ) . urlencode( get_query_var( 's' ) ) );
     111        exit();
     112    }   
     113}
     114
     115// Show page/post id's
     116
     117add_filter('manage_posts_columns', 'expandts_posts_columns_id', 5);
     118add_action('manage_posts_custom_column', 'expandts_custom_id_columns', 5, 2);
     119add_filter('manage_pages_columns', 'expandts_posts_columns_id', 5);
     120add_action('manage_pages_custom_column', 'expandts_custom_id_columns', 5, 2);
     121
     122function expandts_posts_columns_id($defaults){
     123    $defaults['wps_post_id'] = __('ID');
     124    return $defaults;
     125}
     126
     127function expandts_custom_id_columns($column_name, $id){
     128    if($column_name === 'wps_post_id'){
     129        echo $id;
     130    }
     131}
     132
     133// Limit post revisions
     134
     135if (!defined('WP_POST_REVISIONS')) define('WP_POST_REVISIONS', 10);
     136
     137//
     138
     139/* 2.0 - SECURITY */
     140
     141// Remove WordPress version
     142
     143add_filter('the_generator', 'expandts_version_removal');
     144
     145function expandts_version_removal() {
     146    return 'Damn script kiddies';
     147}
     148
     149// Remove login errors
     150
     151add_filter( 'login_errors', 'expandts_hide_errors' );
     152
     153function expandts_hide_errors(){
     154  return 'That doesn\'t look right';
     155}
  • expand2017/trunk/readme.txt

    r1705195 r1708062  
    11=== Expand2017 ===
    22Contributors: chrisb10
    3 Tags: front page, sections, twenty seveteen, theme, redirect, user, search, post, twitter, username,
     3Tags: front page, sections, twenty seveteen, theme, redirect, user, search, post, twitter, limit revisions, id, organisation,
    44Requires at least: 4.0
    55Tested up to: 4.8
    6 Stable tag: 1.2.0
     6Stable tag: 1.3.0
    77License: GPLv2 or later
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html/
     
    1111
    1212== Description ==
    13 Expand2017 adds new features to Automattic's Twenty Seventeen Theme, including:<br>
     13Expand2017 adds new features to Automattic's Twenty Seventeen Theme<br>
    1414
    15 * Adds more front page 'sections'<br>
    16 * If a user's search result only returns one post, the user will be redirected to that post<br>
    17 * Changes Twitter @mentions to the user's Twitter profile<br>
    18 * Adds easy organisation to posts in the dashboard by colour coding different post statuses - published, draft, pending review, private, future<br>
    19 * Adds 8 new contact methods to user's WordPress profile section<br>
    20 * Adds a dynamic menu system<br>
     15=Main Features=
     16
     17* Adds more front page 'sections'
     18* If a user's search result only returns one post, the user will be redirected to that post
     19* Changes Twitter @mentions to the user's Twitter profile
     20* Shows both page and post id's in the admin column
     21* Adds easy organisation to posts in the dashboard by colour coding different post statuses - published, draft, pending review, private, future
     22* Adds 8 new contact methods to user's WordPress profile section
     23* Adds a dynamic menu system
     24* Adds pretty permalinks for search
     25* Shows page and post id's in a new admin column
     26* Limits post revisions to 10
     27
     28=Security Features=
     29
     30* Removes WordPress version number from header
     31* Changes login error message (stops WordPress from telling potential hackers if they've got the username or password right)
    2132
    2233*Note* - Add your feature requests to the support forum, ready for the next update
     
    4960* New Feature: Dynamic menu system
    5061* Miscellaneous: Updated readme
     62= 1.3.0 =
     63* New Feature: Pretty permalinks for search
     64* New Feature: Page and post id's in a new admin column
     65* New Feature: Limits post revisions to 10
     66* New Security Feature: Removes WordPress version number from header
     67* New Security Feature: Changes login error message
     68* Miscellaneous: Updated readme, updated banner and icon
Note: See TracChangeset for help on using the changeset viewer.