Skip to content

Instantly share code, notes, and snippets.

Antonio Villegas avillegasn

Block or report user

Report or block avillegasn

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View init.coffee
# Your init script
#
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
#
# An example hack to log to the console when each text editor is saved.
#
# atom.workspace.observeTextEditors (editor) ->
# editor.onDidSave ->
View testimonial-block-save.js
save: function( props ) {
var attributes = props.attributes;
var alignment = props.attributes.alignment;
return (
el( 'div', { className: props.className },
attributes.mediaURL &&
el( 'div', { className: 'nelio-testimonial-image', style: { backgroundImage: 'url('+attributes.mediaURL+')' } },
el( 'img', { src: attributes.mediaURL } ),
),
el( 'div', { className: 'nelio-testimonial-content', style: { textAlign: attributes.alignment } },
View testimonial-block-edit.js
edit: function( props ) {
var focus = props.focus;
var focusedEditable = props.focus ? props.focus.editable || 'name' : null;
var alignment = props.attributes.alignment;
var attributes = props.attributes;
var contactURL = props.attributes.contactURL;
var onSelectImage = function( media ) {
return props.setAttributes( {
View testimonial-block.js
( function( blocks, components, i18n, element ) {
var el = element.createElement;
blocks.registerBlockType(
// The name of our block. Must be a string with prefix. Example: my-plugin/my-custom-block.
'nelio/testimonial-block', {
// The title of our block.
title: i18n.__( 'Testimonial' ),
View enqueue-css-and-js.php
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}//end if
/**
* Enqueue the block's assets for the editor.
*
* `wp-blocks`: Includes block type registration and related functions.
@avillegasn
avillegasn / remove-ncshare.sql
Created Aug 8, 2017
Remove <ncshare> tags from your WordPress content.
View remove-ncshare.sql
UPDATE wp_posts
SET post_content = REPLACE( REPLACE( post_content, '<ncshare>', '' ), '</ncshare>', '' )
WHERE post_content LIKE '%<ncshare>%'
@avillegasn
avillegasn / custom-admin-logo.php
Last active Feb 19, 2019
How to add a custom logo in WordPress login page
View custom-admin-logo.php
function my_login_logo() { ?>
<style type="text/css">
#login h1 a, .login h1 a {
background-image: url(<?php echo get_stylesheet_directory_uri(); ?>/img/nelio-icon.png);
height: 84px;
width: 84px;
background-size: cover;
background-repeat: no-repeat;
}
</style>
View recurrent-task.php
<?php
function my_hourly_task() {
// Do something every hour. Anything.
}//end my_hourly_task()
add_action( 'my_hourly_event', 'my_hourly_task' );
if ( ! wp_next_scheduled ( 'my_hourly_event' ) ) {
wp_schedule_event( time(), 'hourly', 'my_hourly_event' );
@avillegasn
avillegasn / one-time-task.php
Last active Apr 3, 2017
Schedule a task that executes once in the future at the specified time
View one-time-task.php
<?php
function my_task() {
// Do something. Anything.
}//end my_task()
add_action( 'my_action', 'my_task' );
// Execute my_task one hour from now...
wp_schedule_single_event( time() + 3600, 'my_action' );
@avillegasn
avillegasn / wordpress-additional-files.php
Created Sep 29, 2016
How to allow uploading additional file extensions in WordPress
View wordpress-additional-files.php
<?php
add_filter( 'upload_mimes', 'my_myme_types', 1, 1 );
function my_myme_types( $mime_types ) {
$mime_types['svg'] = 'image/svg+xml'; // Adding .svg extension
$mime_types['json'] = 'application/json'; // Adding .json extension
unset( $mime_types['xls'] ); // Remove .xls extension
unset( $mime_types['xlsx'] ); // Remove .xlsx extension
return $mime_types;
You can’t perform that action at this time.