Skip to content

Instantly share code, notes, and snippets.

View fernandiez's full-sized avatar

Fernan fernandiez

View GitHub Profile
@fernandiez
fernandiez / index.ios.js
Last active November 26, 2021 18:15
Creando una aplicación móvil con React Native usando WordPress REST API
/**
* 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 September 1, 2021 14:56
Bloqueo de IPs .htaccess - Allow Deny
# 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 August 2, 2017 10:13
Dequeue CSS Styles and JavaScript Scripts in child theme
// 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 05:15
Remote WordPress API REST request
<?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 November 25, 2016 13:04
WP Super Cache + Leverage Browser Caching WordPress .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 January 11, 2018 11:21
Customizing WordPress Admin Panel Plugin
<?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 March 11, 2019 12:25
Create menu section under Tools in WordPress admin dashboard and Editor role redirect
<?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 December 20, 2018 09:58
Shortcode Placeholder Image dummyimage_shortcode_function
// 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 April 6, 2017 10:32
Block Bing crawl bots robots.txt
User-agent: Bingbot
Disallow: /
@fernandiez
fernandiez / .htaccess
Created October 18, 2018 13:06
Redirect 301 from old domain to new domain HTTPS
# 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]