Skip to content

Instantly share code, notes, and snippets.

@damiancastelao
Created January 8, 2019 10:02
Show Gist options
  • Save damiancastelao/86ebb3207d21912de04bf4a29e89477f to your computer and use it in GitHub Desktop.
Save damiancastelao/86ebb3207d21912de04bf4a29e89477f to your computer and use it in GitHub Desktop.
<?php
/*
Plugin Name: WP Renym DAM
Plugin URI: http://link to your plugin homepage
Description: This plugin replaces words with your own choice of words.
Version: 1.2
Author: Freddy Muriuki
Author URI: http://link to your website
License: GPL2 etc
License URI: https://link to your plugin license
Copyright YEAR PLUGIN_AUTHOR_NAME (email : your email address)
(Plugin Name) is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
any later version.
(Plugin Name) is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with (Plugin Name). If not, see (http://link to your plugin license).
*/
function renym_wordpress_typo_fix( $text ) {
return str_replace( 'wordpress', '<h3>WordPressDAM</h3>', $text );
}
add_filter( 'the_content', 'renym_wordpress_typo_fix' );
function send($post_ID) {
$friends = 'dam17@danielcastelao.org';
mail($friends,"dam wp5 updated",'Nuevo post');
return $post_ID;
}
add_action('publish_post', 'send');
function contrasinal_olvidada(){
return 'La contraseña es castelao!';
}
add_filter( 'login_errors', 'contrasinal_olvidada' );
function dam18_shortcodes_init()
{
function dam18_shortcode($atts = [], $content = null)
{
// do something to $content
$content = "<div id='dam18'><script>alert('Hi');</script></div>";
global $wpdb;
$charset_collate = $wpdb->get_charset_collate();
$table_name = $wpdb->prefix . 'dam18';
$sql = "CREATE TABLE $table_name (
id mediumint(9) NOT NULL AUTO_INCREMENT,
time datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
name tinytext NOT NULL,
text text NOT NULL,
url varchar(55) DEFAULT '' NOT NULL,
PRIMARY KEY (id)
) $charset_collate;";
require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
dbDelta( $sql );
// always return
return $content;
}
add_shortcode('dam18', 'dam18_shortcode');
}
add_action('init', 'dam18_shortcodes_init');
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment