Skip to content

Instantly share code, notes, and snippets.

View Tmeister's full-sized avatar
🇲🇽
Working from home

Enrique Chavez Tmeister

🇲🇽
Working from home
View GitHub Profile
@Tmeister
Tmeister / sample.css
Created May 3, 2023 18:07
Simple Border
selector a {
box-shadow: 0 0 6px 0 rgba(157, 96, 212, 0.5);
border: solid 1px transparent !important;
background-image: linear-gradient(#000, #000), linear-gradient(140deg, #5666BF, #DFDDE9) !important;
background-origin: border-box;
background-clip: content-box, border-box;
box-shadow: 2px 1000px 1px #000000 inset !important;
}
@Tmeister
Tmeister / webpack.config.js
Created February 28, 2023 02:54
Running @wordpress/scripts start with hot reload on a custom domain
const defaultConfig = require( '@wordpress/scripts/config/webpack.config' );
module.exports = {
...defaultConfig,
devServer: {
...defaultConfig.devServer,
host: 'yourdevdomain.test'
}
}
<?php
add_shortcode('the_shortcode_tag', function($atts){
// En $attts vienen todos tus attributos en forma de array
// Aqui solo verificas tus attributos, y si no existen, le asignas un valor por defecto
$atts = shortcode_atts([
'atributo1' => 'valor por defecto 1',
'atributo2' => 'valor por defecto 2',
], $atts);
@Tmeister
Tmeister / test.php
Created June 22, 2022 00:02
Paginate Links example
<?php
/**
* Plugin Name: A simple hook
* Plugin URI: https://example.com/
* Description: Handle the basics with this plugin.
* Version: 1.0
* Requires at least: 5.2
* Requires PHP: 7.2
* Author: John Doe
@Tmeister
Tmeister / query.php
Last active June 3, 2022 23:27
A simple sample to query two Custom Post Types with a tax_query
<?php
$args = [
'post_type' => ['post', 'work'],
'posts_per_page' => -1,
'tax_query' => [
'relation' => 'OR',
[
'taxonomy' => 'post_tag',
'field' => 'slug',
@Tmeister
Tmeister / rewrite.php
Created May 25, 2022 17:06
A really simple plugin to add a second parameter to the author URL
<?php
/**
* Plugin Name: Rewrite Author URL
* Plugin URI: https://example.com/plugins/the-basics/
* Description: A basic rewrite rules example.
* Version: 1.0.0
* Requires at least: 5.2
* Requires PHP: 7.4
* Author: Enrique Chavez
@Tmeister
Tmeister / tailwind-unpurge.css
Created May 11, 2022 16:57
Tailwind 3.0.24 - Unpurged CSS output
This file has been truncated, but you can view the full file.
/*
! tailwindcss v3.0.24 | MIT License | https://tailwindcss.com
*/
/*
1. Prevent padding and border from affecting element width. (https://github.com/mozdevs/cssremedy/issues/4)
2. Allow adding a border to an element by just adding a border-width. (https://github.com/tailwindcss/tailwindcss/pull/116)
*/
*,
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
@Tmeister
Tmeister / index.php
Created March 21, 2022 17:53
Just a sample plugin, to set the publish view as the default view on the post table view.
<?php
/**
* Plugin Name: Post View Reorder
* Plugin URI: https://example.com/
* Description: Just a test plugin, do not use it on production.
* Version: 1.0.0
* Requires at least: 5.2
* Author: Enrique Chavez
* Author URI: https://enriquechavez.co/
*/
@Tmeister
Tmeister / sample.php
Created February 9, 2022 16:13
Disable Users endpoint on the WP REST API
<?php
add_filter('rest_endpoints', function ($endpoints) {
if (isset($endpoints['/wp/v2/users'])) {
unset($endpoints['/wp/v2/users']);
}
if (isset($endpoints['/wp/v2/users/(?P<id>[\d]+)'])) {
unset($endpoints['/wp/v2/users/(?P<id>[\d]+)']);
}