Skip to content

Instantly share code, notes, and snippets.

Avatar

Fernan fernandiez

View GitHub Profile
@fernandiez
fernandiez / index.ios.js
Last active Nov 26, 2021
Creando una aplicación móvil con React Native usando WordPress REST API
View index.ios.js
/**
* BetaBeers React Native App with WP REST API v 1.0
*/
'use strict';
var React = require('react-native');
var {
AppRegistry,
StyleSheet,
Text,
@fernandiez
fernandiez / .htaccess
Created Sep 1, 2021
Bloqueo de IPs .htaccess - Allow Deny
View .htaccess
# IPs whitelist - block
# deny all Ips
# allow only certain IPs or IP range
ErrorDocument 403 /error403.html
order deny,allow
deny from all
allow from xx.xx.xx.xx
allow from 55.99.66.111
allow from 55.99.66.0/23
allow from 55.99.66.0/24
@fernandiez
fernandiez / functions.php
Created Aug 2, 2017
Dequeue CSS Styles and JavaScript Scripts in child theme
View functions.php
// Dequeue CSS Styles and JavaScript Scripts in child theme
// Dequeue Styles
function dequeue_unnecessary_styles() {
wp_dequeue_style( 'bootstrap-map' );
wp_deregister_style( 'bootstrap-map' );
}
add_action( 'wp_print_styles', 'dequeue_unnecessary_styles' );
// Dequeue JavaScripts
@fernandiez
fernandiez / remote-api-rest.php
Created May 31, 2019
Remote WordPress API REST request
View remote-api-rest.php
<?php
$uri = 'http://www.dominio.com/wp-json/wp/v2/posts/?page=1&per_page=3';
$json = file_get_contents($uri);
$posts= json_decode($json);
echo "<h1>Listado de entradas</h1><ul>";
foreach ($posts as $post) {
echo "<h2><a href='" . $post->link . "'>" . $post->title->rendered . "</a></h2>\n";
echo "<p>" . $post->excerpt->rendered . "</p>";
echo "<p><a href='" . $post->link . "'>Enlace directo</a></p>\n";
@fernandiez
fernandiez / .htaccess
Created Nov 25, 2016
WP Super Cache + Leverage Browser Caching WordPress .htaccess
View .htaccess
# WP Super Cache + Leverage Browser Caching WordPress .htaccess
# http://notlaura.com/wp-super-cache-and-browser-caching/
# BEGIN WPSuperCache
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
#If you serve pages from behind a proxy you may want to change 'RewriteCond %{HTTPS} on' to something more sensible
AddDefaultCharset UTF-8
RewriteCond %{REQUEST_URI} !^.*[^/]$
@fernandiez
fernandiez / customize-wp-admin-panel-plugin.php
Created Jan 11, 2018
Customizing WordPress Admin Panel Plugin
View customize-wp-admin-panel-plugin.php
<?php
/**
*
* Customizing WordPress Admin Panel Plugin
*
* @link https://www.fernan.com.es/
* @since 1.0.0
*
* Plugin Name: Customizing WordPress Admin Panel Plugin
* Plugin URI: https://www.betabeers.com/blog/
@fernandiez
fernandiez / functions.php
Last active Mar 11, 2019
Create menu section under Tools in WordPress admin dashboard and Editor role redirect
View functions.php
<?php
// Create menu section under Tools in WordPress admin
add_action( 'admin_menu', 'docs_admin_menu' );
// New section under Tools
function docs_admin_menu() {
add_management_page( 'Docs', 'Docs', 'manage_categories', 'docs', 'content_docs_admin_menu' );
}
@fernandiez
fernandiez / functions.php
Last active Dec 20, 2018
Shortcode Placeholder Image dummyimage_shortcode_function
View functions.php
// Añadir Shortcode
function dummyimage_shortcode_function( $atts ) {
// Atributos
$atts = shortcode_atts(
array(
'width' => '600',
'height' => '300',
'background' => 'eeeeee',
'text' => 'ffffff',
@fernandiez
fernandiez / robots.txt
Created Apr 6, 2017
Block Bing crawl bots robots.txt
View robots.txt
User-agent: Bingbot
Disallow: /
@fernandiez
fernandiez / .htaccess
Created Oct 18, 2018
Redirect 301 from old domain to new domain HTTPS
View .htaccess
# Redirect from old domain to new domain
RewriteEngine On
RewriteCond %{HTTP_HOST} ^olddomain.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.olddomain.com$
RewriteRule (.*)$ https://www.newdomain.com/$1 [R=301,L]