This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'rest_authentication_errors', function( $result ) { | |
if ( ! empty( $result ) ) { | |
return $result; | |
} | |
if ( ! is_user_logged_in() ) { | |
return new WP_Error( 'rest_not_logged_in', 'You are not currently logged in.', array( 'status' => 401 ) ); | |
} | |
if ( ! current_user_can( 'administrator' ) ) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "my-wp-plugin", | |
"version": "1.0.0", | |
"description": "My WP plugin description", | |
"keywords": [ | |
"my", | |
"wordpress", | |
"plugin" | |
], | |
"author": "avillegasn", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { | |
Component, | |
Fragment, | |
} from '@wordpress/element'; | |
import Icon from './icon.svg'; | |
class MyComponent extends Component { | |
render() { | |
return ( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
* | |
FROM | |
wp_posts i | |
WHERE | |
i.post_type = 'attachment' | |
AND | |
NOT EXISTS (SELECT * FROM wp_posts p WHERE p.ID = i.post_parent) | |
AND | |
NOT EXISTS (SELECT * FROM wp_postmeta pm WHERE pm.meta_key = '_thumbnail_id' AND pm.meta_value = i.ID) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ElementIcon from '../images/logo.svg'; | |
const { Fragment } = wp.element; | |
const { __ } = window.wp.i18n; | |
const { registerFormatType, unregisterFormatType } = window.wp.richText; | |
const { RichTextToolbarButton } = window.wp.blockEditor; | |
unregisterFormatType( 'nelio/button' ); | |
registerFormatType( 'nelio/button', { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Sends and email when a post is published. | |
* | |
* Sends and email using wp_mail standard WordPress function including data about | |
* the post being published. | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Estima el tiempo necesario para leer una entrada en WordPress | |
* | |
* @return string | |
*/ | |
function wpr_estima_tiempo_lectura() { | |
$entrada = get_post(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php // do not include this opening php tag in your file | |
add_filter( 'plugin_action_links_nelio-content/nelio-content.php', 'nc_settings_link' ); | |
function nc_settings_link( $links ) { | |
// Build and escape the URL. | |
$url = esc_url( add_query_arg( | |
'page', | |
'nelio-content-settings', | |
get_admin_url() . 'admin.php' | |
) ); |