Skip to content

Instantly share code, notes, and snippets.

View gist:63853e4ceeae8b653d976af3a1423fac
/* Modal */
.reports-modal{
position: absolute;
width: 80%;
min-height: 400px;
height: auto;
z-index: 1900;
background-color: #fff;
padding: 0.75rem;
border-top: 4px solid #1c5690;
@everaldomatias
everaldomatias / .bashrc
Last active Feb 12, 2021
Adiciona branch do git no prompt
View .bashrc
#define GIT_COLOR_NORMAL ""
#define GIT_COLOR_RESET "\033[m"
#define GIT_COLOR_BOLD "\033[1m"
#define GIT_COLOR_RED "\033[31m"
#define GIT_COLOR_GREEN "\033[32m"
#define GIT_COLOR_YELLOW "\033[33m"
#define GIT_COLOR_BLUE "\033[34m"
#define GIT_COLOR_MAGENTA "\033[35m"
#define GIT_COLOR_CYAN "\033[36m"
#define GIT_COLOR_BOLD_RED "\033[1;31m"
View increment-time.php
<?php
/**
* Soma um ou mais horários no formato 00:00
*
* @link https://vijayasankarn.wordpress.com/2016/12/27/sum-n-times-php/
*
* @param array $times Lista de horários para somar
* @return string
*/
function increment_time(array $times)
@everaldomatias
everaldomatias / wp-query-tax-meta.php
Created Jun 18, 2020
WordPress - Query posts with taxonomy term (NOT EXISTS) and meta value (DATE)
View wp-query-tax-meta.php
<?php
$args = [
'post_type' => 'events',
'posts_per_page' => -1,
'post_status' => 'publish',
'tax_query' => [
[
'taxonomy' => 'event_terms',
'field' => 'slug',
'terms' => 'event_past',
@everaldomatias
everaldomatias / the-file-size.php
Created May 17, 2020
WordPress function for get file size in attachment
View the-file-size.php
if( !function_exists( 'the_file_size' ) ) {
/**
*
* WordPress function for get file size in attachment
*
* @author Everaldo Matias
* @link https://everaldo.dev
*
* @version 1.0
View auto-create-category.php
if ( ! function_exists( 'auto_create_category' ) ) {
/**
*
* Create category with specific CPT is create or updated
*
* @author Everaldo Matias
* @link https://everaldo.dev
*
* @version 1.0
@everaldomatias
everaldomatias / example-kirki-configuration.php
Last active Jan 16, 2020
Example for the Kirki WordPress Plugin configuration
View example-kirki-configuration.php
<?php
/**
*
* Config, Panels, Sections and Fields by Kirki
*
* @link https://kirki.org/
* @author Everaldo Matias <https://everaldo.dev>
* @since 16/01/2020
* @version 1.0
@everaldomatias
everaldomatias / the_remove_wp_style.php
Created Oct 22, 2019
Função para remover um stylesheet do WordPress
View the_remove_wp_style.php
<?php
/**
*
* Função para remover um stylesheet do WordPress.
* Por padrão o WordPress imprime o ID do style na tag <link> com um sufixo -css, exemplo 'theme-media-css', nesse caso o ID é apenas 'theme-media'
*
* @author Everaldo Matias <https://everaldo.dev>
* @uses Aplique no functions.php do seu tema (ou plugin)
* @since 20191022
@everaldomatias
everaldomatias / register_post_type_labels.php
Last active Sep 12, 2019
WordPress register_post_type labels
View register_post_type_labels.php
<?php
[
'name' => __( '', '' ),
'singular_name' => __( '', '' ),
'add_new' => __( '', '' ),
'add_new_item' => __( '', '' ),
'edit_item' => __( '', '' ),
'new_item' => __( '', '' ),
'view_item' => __( '', '' ),
'view_items' => __( '', '' ),
View virtual-page.php
<?php
/**
* Add virtual page on WordPress hierarchy
* @link https://metabox.io/how-to-create-a-virtual-page-in-wordpress/
*/
add_filter( 'generate_rewrite_rules', function ( $wp_rewrite ){
$wp_rewrite->rules = array_merge(
['example/(\w+)/?$' => 'index.php?exp=$matches[1]'],