Skip to content

Instantly share code, notes, and snippets.

@felipeelia
Created December 10, 2017 20:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save felipeelia/e439efa1d3f58175c7ca21ee42c99d65 to your computer and use it in GitHub Desktop.
Save felipeelia/e439efa1d3f58175c7ca21ee42c99d65 to your computer and use it in GitHub Desktop.
Meus snippets no Atom
'.text.html':
'WP Plugin - empty index':
'prefix': 'plugin_index'
'body': """
<?php
// Silence is golden
"""
'WP Plugin - new plugin':
'prefix': 'plugin_file'
'body': """
<?php
/**
* Plugin Name: ${1:Nome do plugin}
* Description: ${2:Descrição do plugin}
* Version: 1.0
* Author: ${3:Autor do plugin}
* Author URI: ${4:URL do autor do plugin}
* Text Domain: ${5:text-domain}
* Domain Path: /languages
*
* @package ${6:package}
*/
defined( 'ABSPATH' ) || exit;
define( '${7:Constante}_FILE', __FILE__ );
class ${8:Nome da classe} {
protected static $instance = null;
private function __construct() {
}
public static function get_instance() {
if ( null == self::$instance ) {
self::$instance = new self;
}
return self::$instance;
}
}
add_action( 'plugins_loaded', array( '${8:Nome da classe}', 'get_instance' ) );
"""
'.source.php':
'WP Template name':
'prefix': 'template'
'body': """
/**
* Template name: ${1:Template}
*
* @package ${2:package}
*/
"""
'WP config db':
'prefix': 'wpdb_switch'
'body': """
// Em wp-cli não existe $_SERVER['HTTP_HOST']
if ( isset( $_SERVER['HTTP_HOST'] ) && 'localhost' != $_SERVER['HTTP_HOST'] ) {
switch ( $_SERVER['HTTP_HOST'] ) {
case 'duo-me.com':
$db_host = 'localhost';
$db_name = 'duome179_';
$db_user = 'duome179_';
$db_pass = '';
break;
default:
$db_host = 'localhost';
$db_name = '';
$db_user = '';
$db_pass = '';
break;
}
} else {
$db_host = '127.0.0.1'; // para docker usar mysql
$db_name = '${1:nome do banco}';
$db_user = 'root';
$db_pass = '';
}
define( 'DB_HOST', $db_host );
define( 'DB_NAME', $db_name );
define( 'DB_USER', $db_user );
define( 'DB_PASSWORD', $db_pass );
"""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment