Skip to content

Instantly share code, notes, and snippets.

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

Jimmy Andrade jimmyandrade

🏠
Working from home
View GitHub Profile
<!DOCTYPE html>
<html lang="pt-br">
<head>
<meta charset="UTF-8" />
<title>Título da página</title>
<style type="text/css">
<!--
.colunas form {
display: inline;
float: left;
@jimmyandrade
jimmyandrade / author-posts.php
Last active March 17, 2017 17:46
Author like get posts
<?php
private static function tax_query_name_like( $taxonomy, $term ) {
global $wpdb;
$statement = $wpdb->prepare(
"
SELECT term_taxonomy_id
FROM $wpdb->terms
JOIN $wpdb->term_taxonomy
USING (term_id)
@jimmyandrade
jimmyandrade / user-menu.php
Last active March 17, 2017 17:46
User menu
<?php
global $current_user;
$my_page_args = array(
'post_type' => 'page',
'post_status' => 'publish',
'meta_query' => array(
array(
'key' => '_wp_page_template',
'value' => 'page-profile.php', // template name as stored in the dB
@jimmyandrade
jimmyandrade / example.php
Last active March 17, 2017 17:46
Author like get posts example
<?php
global $wp_query;
$args = apply_filters( 'author_like_get_posts', $wp_query->query_vars );
query_posts( $args );
get_header();
?>
@jimmyandrade
jimmyandrade / alerts.css
Last active March 17, 2017 17:45
Alert CSS sample
.alert.alert-info {
background-color: rgb(217, 237, 247);
border-bottom-left-radius: 4px;
border-radius: 4px;
border: 1px solid rgb(188, 232, 241);
color: rgb(49, 112, 143);
font-size: 14px;
min-height: 52px;
line-height: 20px;
margin-bottom: 20px;
@jimmyandrade
jimmyandrade / class.type.php
Last active March 17, 2017 17:45
Type taxonomy
<?php
namespace Bookpress\Taxonomies;
class Type {
/**
* Hook into the 'init' action
*/
public function __construct() {
@jimmyandrade
jimmyandrade / template-redirect.php
Last active March 17, 2017 17:45
Template redirect
<?php
public static function template_redirect() {
$current_user_id = get_current_user_id();
if ( is_search() && is_user_logged_in() ) {
$search_query = get_search_query();
$last_search_queries = get_user_meta( $current_user_id, 'last_search_queries', true );
$last_search_queries[] = $search_query;
$last_search_queries = apply_filters( 'search_queries', $last_search_queries );
<?php
namespace UFVJM\Widgets;
/**
* Adiciona o widget da barra de migalhas
*/
class Breadcrumbs extends \WP_Widget {
/**
* Constrói o widget da barra de migalhas
@jimmyandrade
jimmyandrade / README.md
Created April 27, 2015 00:20
Some LANDR Portuguese (Brazil) mistranslations
Most appropriate translation in Portuguese
Original in English Mistranslation in Portuguese
@jimmyandrade
jimmyandrade / class-historico.php
Created May 23, 2015 23:20
Classe "Histórico"
<?php
namespace Taekwondo\Admin_Pages;
class Historico {
public static function gerar_grafico($id, $colunas, $dados, $config ) {
?>
<script>
google.setOnLoadCallback(desenharGrafico<?php echo esc_js( $id ); ?>);