To have a gulp workflow that with a single process,
- watches for any sass changes, then compiles sass source into css
- watches for any changes in the public directory, triggers live-reload
- serves your static content in
public/
<?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; | |
} |
<?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' ); |
<?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( |
<?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' ); |
add_action('admin_bar_menu', 'show_template'); | |
function show_template() { | |
global $template; | |
print_r($template); | |
} |
<?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; | |
} |
<?php | |
function enqueue_scripts() { | |
wp_enqueue_script( 'jquery-ui-core' ); | |
} | |
add_action( 'wp_enqueue_scripts', 'enqueue_scripts' ); |
<?php | |
/** | |
* Hide editor on specific pages. | |
* | |
*/ | |
add_action( 'admin_init', 'hide_editor' ); | |
function hide_editor() { | |
// Get the Post ID. |