Skip to content

Instantly share code, notes, and snippets.

@warderer
warderer / index.html
Created November 29, 2022 16:47
[Isometric 3D Menu] CSS 3D Isometric Menu #css #menu
<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="style.css">
<title>Isometric Menu</title>
</head>
<body>
@warderer
warderer / functions.php
Last active October 23, 2022 01:34
[Remove WP Version Number] Hackers usually look for version number first when checking for vulnerabilities. By default wordpress prints the version number in header, rss feed, scripts and styles. #wordpress #security
# In template file functions.php
# Remove version from header:
remove_action('wp_head', 'wp_generator');
# Remove version from RSS feed
function remove_version_info() {
return '';
}
add_filter('the_generator', 'remove_version_info');
@warderer
warderer / apiCall.js
Last active August 17, 2022 15:30
[React API Call Template with Fetch] Boilerplate code for implementing generic API call with fetch in react projects #react #api #fetch
// This file usually is under API or Services folder.
export default async function apiCall(
url, {
method = "GET",
body,
headers = {}
}) {
try {
const response = await fetch(url, {
method,
@warderer
warderer / .htaccess
Created June 22, 2022 22:59
[Disable WordPress XML-RPC with .htaccess] XML-RPC API is safe and enabled by default on all WordPress websites. However, some security experts may advise you to disable it. #wordpress #security #xmlrpc
# Method 1 for Blocking XMLRPC request before the request is even passed onto WordPress.
# Begin - Block WordPress xmlrpc.php requests
<Files xmlrpc.php>
order deny,allow
deny from all
allow from 123.123.123.123 # Optional: Specify allowed ip
</Files>
# End - Block WordPress xmlrpc.php requests
# Reference: https://www.wpbeginner.com/plugins/how-to-disable-xml-rpc-in-wordpress/
@warderer
warderer / .htaccess
Created May 22, 2022 15:35
[Wordpress Enhanced Security] Small tweaks via functions.php to improve wordpress security. #wordpress #security
# disabling PHP file execution in directories where it’s not needed such as /wp-content/uploads/
<Files *.php>
deny from all
</Files>
# Disable file indexing
Options -Indexes
@warderer
warderer / git-guide.md
Last active February 20, 2022 05:33
[Comandos Git] Guía rápida y de referencia de uso de #git.

git status: Conocer el estado de mis cambios en el WORKING DIRECTORY y STAGING AREA

git status --> Muestra el "estado" actual de los archivos agregados/eliminados o modificados desde el último commit. Este comando ocupa mucho espacio visual en la consola.

git status -s --> Me muestra el "estado" actual de los archivos agregados/eliminados o modificados desde el último commit. Pero de forma más simplicifcada, solo coloca unos simbolos/letras (en color rojo o verde) para indicarnos el estado del archivo y el nombre del archivo.

Entre los simbolos/ letras que nos muestra estan:

  • M - Modified
  • A - Added
  • D - Deleted
@warderer
warderer / functions.php
Last active December 30, 2021 22:33
[Disable All-in-One SEO-Pack for WordPress custom post type (CPT)] Remove the metabox aioseo-settings from specific custom post type "add new" screen and aiosp metabox from listing view on admin. #wordpress #allinoneseo
/**
* Remove All in One SEO from custom post type (CPT)
*
*/
function wpse_55088_remove_aiosp() {
remove_meta_box( 'aioseo-settings', 'CUSTOM_CPT_NAME_HERE', 'normal' );
remove_meta_box( 'aioseo-settings', 'CUSTOM_CPT_NAME_HERE', 'side' );
remove_meta_box( 'aiosp', 'CUSTOM_CPT_NAME_HERE', 'advanced' );
}
add_action( 'add_meta_boxes', 'wpse_55088_remove_aiosp' );
@warderer
warderer / functions.php
Created December 29, 2021 06:09
[Custom Logo and Background on Wordpress Login] Simple enhacement changing the wp-login view with a custom logo and a background color via template functions.php on #wordpress
/* = Customize login page
Reference: https://sgwebpartners.com/es/how-to-customize-login-logo-on-wordpress/
---------------------------------------------------- */
function sgwp_custom_login_logo(){
echo
"<style type='text/css'>
body.login { background-color: #00629e; } //LOGIN BACKGROUND COLOR HERE
body.login h1 a { background-image: url(". get_site_url() ."/wp-content/uploads/2021/00/LOGO_FILE_URL_HERE.PNG);
background-size: 162px 80px; width: 162px; height: 80px; }
@warderer
warderer / functions.php
Created October 5, 2021 06:47
[Show All Post Meta Keys and Values for a Post in WordPress] If you wanted to see all the post meta keys and values for a post,page or custom post type in WordPress you can either see them in the database in the wp_postmeta table or you could use the get_post_meta function to retrieve all the post meta or a specific key. #wordpress #cpt #get_pos…
/*
If you wanted to see all the post meta keys and values for a post,page or custom post type in WordPress you can either see them in the database in the wp_postmeta table or you could use the get_post_meta function to retrieve all the post meta or a specific key.
To output the data to the head of the page you can just hook the output to wp_head.
You can also use this code in a shortcode inside a query.
Source: https://wpbeaches.com/show-all-post-meta-keys-and-values-for-a-post-in-wordpress/
*/
@warderer
warderer / functions.php
Last active September 29, 2021 00:33
[Shortcode for Retreive One Taxonomy Description] In a Project i needed to retrieve one taxonomy description for using as a "global variable" in various locations of the web site. This shortcode can be provided with the taxonomy name and item number from an orderer taxonomy list #wordpress #shortcode #taxonomy
/*
* Example: [term-list term="taxonomy term here" sesion="session number"]
*/
function custom_taxonomy_description_shortcode( $atts ) {
//Definimos valores por defecto en caso de que no se indique en el shortcode
$atts = shortcode_atts( array(
'term' => 'sessions',
'sesion' => 0
), $atts );