Skip to content

Instantly share code, notes, and snippets.

View chrdesigner's full-sized avatar

César Ribeiro chrdesigner

View GitHub Profile
@chrdesigner
chrdesigner / .htaccess
Created December 21, 2023 15:13
htaccess redirect www to non-www
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
</IfModule>
@chrdesigner
chrdesigner / functions.php
Created November 17, 2022 14:21
Use GD instead of Imagick.
<?php
/** * Use GD instead of Imagick.
*/
function chr_use_gd_editor($array) {
return array( 'WP_Image_Editor_GD' );
}
add_filter( 'wp_image_editors', 'chr_use_gd_editor' );
@chrdesigner
chrdesigner / filter-external.js
Created September 17, 2018 19:21
Sub Menu + Filter TAG ~ External
$('.filterBlog a').on('click', function(e) {
filterBlogHash(this.hash, e);
});
$(window).on('load',function() {
filterBlogHash(window.location.hash);
});
function filterBlogHash(hash, e) {
if(hash === '') {
@chrdesigner
chrdesigner / filter.js
Created September 17, 2018 19:20
Sub Menu + Filter TAG ~ Simple
$('.filterBlog').on('click', 'a', function(e){
e.preventDefault();
var hash = $(this).attr('href').replace(/^.*?(#|$)/,'');
$('.filter a.type').each(function (index, value) {
// console.log('filter' + index + ':' + $(this).attr('id'));
@chrdesigner
chrdesigner / functions.php
Last active November 9, 2017 12:08
Function to create a custom related post list by tag and category
<?php
/**
* Related Posts.
*
* Usage:
* To show related by categories:
* Add in single.php <?php chr_related_posts(); ?>
* To show related by tags:
* Add in single.php <?php chr_related_posts( 'tag' ); ?>
*
@chrdesigner
chrdesigner / 00-README.md
Last active June 14, 2017 16:46
Git List - Post views Count
@chrdesigner
chrdesigner / 00-README.md
Created February 16, 2017 17:04
Git List - Exibir ou Ocultar a sua senha com jQuery
@chrdesigner
chrdesigner / 00-README.md
Last active November 4, 2016 22:52
Git List - Executar um vídeo a partir de um click na thumbnail
@chrdesigner
chrdesigner / update_row_colours.js
Created September 25, 2016 17:03
Aplica verificação de cor na tabela se a data é maior ou não, dentro do field repeater ACF
jQuery(document).ready(function($) {
var update_row_colours = function() {
$('[data-name="adicionar_experiencias"] .acf-table .acf-row').each( function() {
var strat = $( this ).find('[data-name="iniciou_no_dia"] input.input-alt');
var end = $( this ).find('[data-name="terminou_no_dia"] input.input-alt');
var strat_date = new Date( strat.val() );
@chrdesigner
chrdesigner / README.md
Last active April 15, 2016 20:04
Borda Serrilhada Somente com CSS 3