This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| ---------- Shortcode for Youtube videos | |
| Alan | |
| */ | |
| class short_youtube { | |
| function shortcode($atts, $content = null) | |
| { | |
| extract(shortcode_atts(array( | |
| 'alinhamento' => '', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| $args = array( | |
| 'blog_id' => $GLOBALS['blog_id'], | |
| 'role' => 'author', | |
| 'role__in' => array(), | |
| 'role__not_in' => array(), | |
| 'meta_key' => '', | |
| 'meta_value' => '', | |
| 'meta_compare' => '', | |
| 'meta_query' => array(), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* Get user info. */ | |
| global $current_user, $wp_roles; | |
| //get_currentuserinfo(); //deprecated since 3.1 | |
| $post_id = $_GET['post_id']; | |
| $user_id = get_current_user_id(); | |
| $current_user = wp_get_current_user(); | |
| $avatarArr = get_field('avatar', 'user_'. $user_id ); //Using ACF |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| ------------------------------- | |
| Imprime uma mensagem de cumprimento ao usuário baseado na hora local | |
| Alan | |
| */ | |
| date_default_timezone_set("America/Sao_Paulo"); // Seta o timezone para o nosso fuso-horário | |
| $time = date("H"); // pega a hora atual no formato 24h | |
| if ($time < "8") { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| $id = get_the_ID(); | |
| $tipos = wp_get_post_terms( $id, 'tipo', '' ); | |
| //print_r($tipos); | |
| $tipoSlug = ''; | |
| foreach ($tipos as $tipo) { | |
| $tipoSlug .= $tipo->slug . ' '; //concatenate the terms with space between | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <pre> | |
| <?php | |
| $terms = get_terms([ | |
| 'taxonomy' => 'tipo', | |
| 'hide_empty' => false, | |
| ]); | |
| print_r($terms); | |
| ?> | |
| </pre> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* echo, inline */ | |
| echo 'Based on your score, you are a ',($score > 10 ? 'genius' : 'nobody'); //harsh! | |
| /* shorthand usage */ | |
| $message = 'Hello '.($user->get('first_name') ?: 'Guest'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $ancestor = get_post_ancestors($post)[0]; | |
| if ($ancestor == 16349) { // se for filha de "os distritos" | |
| echo '<h2>Localização</h2>'; | |
| include 'includes/mapa-local-atrativo.php'; | |
| } |