This file contains 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 | |
/* | |
Plugin Name: LB Force HTTPS | |
Plugin URI: | |
Description: Redirect all visits to https | |
Author: leobaiano | |
Author URI: | |
Version: 0.0.1 | |
*/ |
This file contains 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
1 - No arquivo httpd.conf descomenta a linha #NameVirtual Host *:80 | |
2 - Criando um host | |
<VirtualHost 127.0.0.1> | |
DocumentRoot "caminho-da-pasta-do-site" | |
ServerName dominio-que-vc-quer | |
ServerAlias *.dominio-que-vc-quer | |
<Directory "caminho-da-pasta-do-site"> | |
Options All Includes Indexes |
This file contains 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 | |
global $post; | |
$categorias_do_post = get_the_category( $post->ID ); | |
if ( file_exists( 'diretorio_com_templates/template-' . $categorias_do_post[0]->slug . '.php' ) { | |
require 'diretorio_com_templates/template-' . $categorias_do_post[0]->slug . '.php'; | |
} else { | |
require 'diretorio_com_templates/template-default.php'; | |
} |
This file contains 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
add_action('parse_request', 'cpt_parent_page' ); | |
function cpt_parent_page( $wp ) { | |
if ( isset ( $wp->query_vars['attachment'] ) && ! empty( $wp->query_vars['attachment'] ) ) { | |
$page = get_page_by_path( | |
$wp->request, | |
OBJECT, | |
array( 'page', 'book' ) | |
); | |
if ( $page instanceof WP_Post ) { | |
$wp->query_vars = [ 'page_id' => $page->ID ]; |
This file contains 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 | |
/** | |
* Plugin Name: LB Profile Extra Fields | |
* Plugin URI: | |
* Description: Create Extra Fields in Profile | |
* Author: leobaiano | |
* Author URI: https://profiles.wordpress.org/leobaiano/ | |
* Version: 0.0.1 | |
* License: GPLv2 or later | |
* Text Domain: lb_profile_extra_fields |
This file contains 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 | |
// Utiliza pre_get_posts para incluir posts privados no resultado de buscas quando o usuário estiver logado | |
function incluir_posts_privados_no_resultado_da_busca( $query ) { | |
// Se estiver no painel administrativo ou se não for a query principal retorna sem fazer nada | |
if ( is_admin() || ! $query->is_main_query() ) | |
return; | |
// Verifica se o usuário está logado e se é a query de busca | |
if( is_user_logged_in() && is_search() ) { | |
// Define que o post_status da query de busca deve incluir publish e private |
This file contains 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
function createRandomArray( lenght, max ) { | |
return Array.apply( null, Array ( lenght ) ).map( function( _, i ) { | |
return Math.round( Math.random() * max ); | |
}); | |
} | |
console.log( createRandomArray( 20, 300 ) ); |
This file contains 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
<svg width="400" height="400" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" class="mapa-svg"> | |
<g> | |
<title>Layer 1</title> | |
<g stroke="null" id="svg_1" class="mapa_click"> | |
<a stroke="null" id="svg_2" xlink:href="#tocantins"> | |
<path stroke="#FFFFFF" id="svg_3" d="m245.800217,199.995651c13.656509,0.48761 38.137955,-26.83725 38.02092,-38.380478c-0.115326,-11.543243 -14.608826,-49.563316 -18.952362,-56.043877c-4.343567,-6.468681 -32.144165,2.125145 -32.144165,2.125145s-33.316116,90.648972 13.075607,92.29921z" stroke-linejoin="round" stroke-linecap="round" stroke-width="1.0404"/> | |
<text stroke="null" id="svg_4" fill="#FFFFFF" transform="matrix(0.8480188846588135,0,0,0.8480188846588135,243.642590741102,159.867229951089) ">TO</text> | |
</a> | |
<a stroke="null" id="svg_5" xlink:href="#bahia"> | |
<path stroke="#FFFFFF" id="svg_6" d="m265.913513,167.884567c1.767273,-2.322723 2.973175,-5.94632 5.481598,-7.432053c1.391602,-0.825104 2.740784,-3.972107 3.621887,-4.378311c1.953827 |
This file contains 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( | |
'post_parent' => $post->ID, | |
'post_type' => 'attachment', | |
'numberposts' => -1, // show all | |
'post_status' => 'any', | |
'post_mime_type' => 'image', | |
'orderby' => 'menu_order', | |
'order' => 'ASC' | |
); |
This file contains 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 | |
if ( ! defined( 'ABSPATH' ) ) | |
exit; // Exit if accessed directly. | |
/** | |
* Pimap Options. | |
* | |
* @package Pimap/Admin | |
* @category Admin | |
* @author Leo Baiano <leobaiano@lbideias.com.br> | |
*/ |