Skip to content

Instantly share code, notes, and snippets.

View johanguse's full-sized avatar
🏠
Working from home

Johan Guse johanguse

🏠
Working from home
View GitHub Profile
@luetkemj
luetkemj / wp-query-ref.php
Last active May 25, 2024 10:56
WP: Query $args
// This gist is now maintained on github at https://github.com/luetkemj/wp-query-ref
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.github.io
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query#Parameters
* Source: https://core.trac.wordpress.org/browser/tags/4.9.4/src/wp-includes/query.php
*/
@ografael
ografael / combo_dinamico.html
Created March 14, 2012 15:12
Carregar combo com JQuery - Cidades e Estados
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<script type="text/javascript" src="jquery-1.7.1.min.js"></script>
<script type="text/javascript">
$(document).ready(function () {
$.getJSON('estados_cidades.json', function (data) {
@letanure
letanure / estados-cidades.json
Last active July 22, 2024 21:10
JSON estados cidades do brasil, dividido por estados. segunda lista atualizada em 2020, dados do IBGE
{
"estados": [
{
"sigla": "AC",
"nome": "Acre",
"cidades": [
"Acrelândia",
"Assis Brasil",
"Brasiléia",
"Bujari",
@omurphy27
omurphy27 / Bootstrap Tabs used with Advanced Custom Fields ACF PHP JS HTML.php
Last active September 16, 2021 05:52
Bootstrap Tabs used with Advanced Custom Fields ACF PHP JS HTML
<?php if( have_rows('tabs') ): ?>
<ul class="nav nav-tabs" id="myTab" role="tablist">
<?php $i=0; while ( have_rows('tabs') ) : the_row(); ?>
<?php
$string = sanitize_title( get_sub_field('tab_title') );
?>
<li role="presentation" <?php if ($i==0) { ?>class="active"<?php } ?> >
<a href="#<?php echo $string ?>" aria-controls="<?php echo $string ?>" role="tab" data-toggle="tab"><?php the_sub_field('tab_title'); ?></a>
</li>
<?php $i++; endwhile; ?>
@MikeNGarrett
MikeNGarrett / wp-config.php
Last active July 17, 2024 18:02
All those damned wp-config constants you can never remember.
<?php
// PHP memory limit for this site
define( 'WP_MEMORY_LIMIT', '128M' );
define( 'WP_MAX_MEMORY_LIMIT', '256M' ); // Increase admin-side memory limit.
// Database
define( 'WP_ALLOW_REPAIR', true ); // Allow WordPress to automatically repair your database.
define( 'DO_NOT_UPGRADE_GLOBAL_TABLES', true ); // Don't make database upgrades on global tables (like users)
// Explicitely setting url
@thierrypigot
thierrypigot / acf-polylang.php
Created January 5, 2017 20:31
Add polylang support to ACF fields group
<?php
add_filter('pll_get_post_types', 'wearewp_add_acf_pll', 10, 2);
function wearewp_add_acf_pll( $post_types, $is_settings ) {
$post_types[] = 'acf-field-group';
return $post_types;
}
@mixin breakpoint( $start, $stop: null ) {
$breakpoints: (
'small': 480px,
'medium': 720px,
'large': 960px,
'huge': 1200px,
'container': $container,
);
$start: validate-point( $start, $breakpoints );
@marcosnakamine
marcosnakamine / class.ys_mail.php
Last active November 18, 2023 06:57
WordPress - Send mail wp_mail with attachment
<?php
class YS_Mail {
public function YS_Mail() {}
public function enviar( $e ) {
$headers = "From: ".$e['from_name']." <".$e['to_mail']."> \n";
$headers .= "Reply-To:".$e['from_name']." <".$e['from_mail']."> \n";
@marcosnakamine
marcosnakamine / index.php
Last active July 4, 2018 19:44
WordPress - Really Simple CAPTCHA plugin with custom form
<?php
// https://br.wordpress.org/plugins/really-simple-captcha/
$captcha_instance = new ReallySimpleCaptcha();
$captcha_instance->bg = array( 255, 255, 255 );
$word = $captcha_instance->generate_random_word();
$prefix = mt_rand();
$img_captcha = $captcha_instance->generate_image( $prefix, $word );
if ( isset( $_POST['send'] ) && $_POST['send'] == 'ok' ) {
if ( $captcha_instance->check( $_POST['prefix'], $_POST['captcha'] ) ) {
@marcosnakamine
marcosnakamine / index.php
Created August 17, 2017 18:19
WordPress - Menu with Bootstrap 4 Navbar
<?php
$menu_items = wp_get_nav_menu_items('Menu Principal'); // PEGA TODOS OS ITENS DO Menu Principal
$menu_mobile = array();
foreach ( $menu_items as $key => $value ) { // SEPARA OS ITENS EM SUBMENUS
if ( !is_array( $menu_mobile[$value->menu_item_parent] ) ) {
$menu_mobile[$value->menu_item_parent] = array();
}
array_push( $menu_mobile[$value->menu_item_parent], $value );
}
?>