Skip to content

Instantly share code, notes, and snippets.

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

Walter Jaworski walterjaworski

🏠
Working from home
View GitHub Profile
@leobaiano
leobaiano / filter_custom_field_search_wordpress_admin.php
Created July 22, 2015 21:31
Filter Posts Search Admin WordPress - Custom Field
<?php
function my_admin_post_search_by_custom_fields( $query ) {
if ( ! is_admin() ) {
return;
}
// Search just for posts
if ( isset( $query->query_vars['post_type'] ) && 'post' !== $query->query_vars['post_type'] ) {
return;
}
@ditikos
ditikos / functions.php
Created July 22, 2015 11:52
Wordpress admin add Google Maps Metabox
<?php
// ... include at the end of functions.php
// 1. Add google maps -- REQUIRED GOOGLE MAPS API KEY
function wp_google_scripts() {
$API_KEY = "AIzaSyAj1hqhXwaUnJDZzisebduqKg2QFsCYCS4";
wp_enqueue_script( 'google-maps-native', "http://maps.googleapis.com/maps/api/js?key=".$API_KEY);
}
add_action( 'admin_enqueue_scripts', 'wp_google_scripts' );
@leobaiano
leobaiano / filter_search_WordPress_per_taxonomy.php
Created July 22, 2015 04:34
Filotro de busca WordPress com taxonomys
<?php
function filter_search( $query ) {
if ( !is_admin() && $query->is_main_query() && $query->is_search ) {
$tax_query = array(
array(
'taxonomy' => 'frutas',
'field' => 'slug',
'terms' => 'laranja'
),
array(
@theRemix
theRemix / README.md
Last active February 28, 2023 14:37
The Holy Grail - Gulp + Sass + LiveReload + Foundation

Gulp + Sass + LiveReload + Foundation

Goals

To have a gulp workflow that with a single process,

  1. watches for any sass changes, then compiles sass source into css
  2. watches for any changes in the public directory, triggers live-reload
  3. serves your static content in public/
<?php
$args = array(
'post_type' => "eventos",
'posts_per_page' => -1,
'meta_key' => 'data',
'orderby' => 'data',
'order' => 'ASC'
);
setlocale( LC_ALL, 'pt_BR', 'pt_BR.iso-8859-1', 'pt_BR.utf-8', 'portuguese' );
date_default_timezone_set( 'America/Sao_Paulo' );
@gugaalves
gugaalves / functions.php
Created July 17, 2014 23:30
Vendo qual arquivo do tema está rodando!
add_action('admin_bar_menu', 'show_template');
function show_template() {
global $template;
print_r($template);
}
@leocomelli
leocomelli / git.md
Last active June 27, 2024 20:12
Lista de comandos úteis do GIT

GIT

Estados

  • Modificado (modified);
  • Preparado (staged/index)
  • Consolidado (comitted);

Ajuda

@fdaciuk
fdaciuk / functions.php
Created May 4, 2013 22:46
Funções para minimizar o caminho das pedras no WP :P (Na real, só pra não ficar chamando as funções gigantes do WP pra pegar o caminho dos arquivos)
<?php
/*
Use para chamar qualquer arquivo dentro do tema.
Ex: echo theme_url( 'assets/images/logo.png' );
*/
function theme_url( $path = null ) {
return get_template_directory_uri() . '/' . $path;
}
@fdaciuk
fdaciuk / functions.php
Created May 4, 2013 14:33
Adicionar jQuery UI do WordPress para usar no tema.
<?php
function enqueue_scripts() {
wp_enqueue_script( 'jquery-ui-core' );
}
add_action( 'wp_enqueue_scripts', 'enqueue_scripts' );
@ramseyp
ramseyp / hide-editor.php
Created November 12, 2012 15:48
Hide the content editor for certain pages in WordPress
<?php
/**
* Hide editor on specific pages.
*
*/
add_action( 'admin_init', 'hide_editor' );
function hide_editor() {
// Get the Post ID.