Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View asllanmaciel's full-sized avatar
🎯
Focusing

Asllan Maciel asllanmaciel

🎯
Focusing
View GitHub Profile
@asllanmaciel
asllanmaciel / autocomplete-estados.html
Created July 27, 2023 10:19
Autocompletar input com estados usando AJAX
<style>
#estado-sugestao {
position: absolute;
width: 100%;
height: 100%;
background-color: #fff;
z-index: 1000;
list-style-type: none;
margin: 0;
padding: 0;
@asllanmaciel
asllanmaciel / estadosBrasileiros.json
Created July 27, 2023 10:11
JSON para Estados Brasileiros
[
{
"name": "Acre",
"sigla": "AC"
},
{
"name": "Alagoas",
"sigla": "AL"
},
{
@asllanmaciel
asllanmaciel / validatePhoneNumber.php
Created July 27, 2023 09:48
Para validar um campo usando o padrão 99-99999-9999 no PHP, WordPress e Elementor, você pode usar esse código
<?php
function validatePhoneNumber($phone_number) {
// Check if the phone number is empty
if (empty($phone_number)) {
return false;
}
// Check if the phone number is 10 digits long
if (strlen($phone_number) != 10) {
{
"AED": "United Arab Emirates Dirham",
"AFN": "Afghan Afghani",
"ALL": "Albanian Lek",
"AMD": "Armenian Dram",
"ANG": "Netherlands Antillean Guilder",
"AOA": "Angolan Kwanza",
"ARS": "Argentine Peso",
"AUD": "Australian Dollar",
"AWG": "Aruban Florin",
@asllanmaciel
asllanmaciel / ramos_de_atividade.txt
Created September 18, 2022 22:59 — forked from prodis/ramos_de_atividade.txt
Lista de ramos de atividade
Alimentos e Bebidas
Arte e Antiguidades
Artigos Religiosos
Assinaturas e Revistas
Automóveis e Veículos
Bebês e Cia
Blu-Ray
Brindes / Materiais Promocionais
Brinquedos e Games
Casa e Decoração
<?php
function wp24h_add_meta_tags() {
// homepage
if (is_home()) {
echo '<meta name="description" content="' . get_bloginfo( "description" ) . '" />' . "\n";
}
// single post page
if ( is_singular() ) {
global $post;
$meta_description = strip_tags($post->post_content);
<?php
/***
* Para usar o shortcode como Tag Dinâmica (Site > Shortcode) na URL do botão
* [btn-assinar plano=00] - 00 é o ID do Plano
*
* Se quiser, pode redirecionar para outra base, da seguinte forma:
* [btn-assinar base="https://dominio.com.br/xpto?parametro=valor" plano=00]
*
* Usar no functions.php no tema filho (não usar no pai)
@asllanmaciel
asllanmaciel / payment-methods-list-svg.html
Created August 10, 2022 12:32
Métodos de Pagamentos com SVGs
<div class="payment-methods-list payment-methods-list--auto">
<svg xmlns="http://www.w3.org/2000/svg" role="img" viewBox="0 0 38 24" width="38" height="24" aria-labelledby="pi-american_express"><title id="pi-american_express">American Express</title><g fill="none"><path fill="#000" d="M35,0 L3,0 C1.3,0 0,1.3 0,3 L0,21 C0,22.7 1.4,24 3,24 L35,24 C36.7,24 38,22.7 38,21 L38,3 C38,1.3 36.6,0 35,0 Z" opacity=".07"></path><path fill="#006FCF" d="M35,1 C36.1,1 37,1.9 37,3 L37,21 C37,22.1 36.1,23 35,23 L3,23 C1.9,23 1,22.1 1,21 L1,3 C1,1.9 1.9,1 3,1 L35,1"></path><path fill="#FFF" d="M8.971,10.268 L9.745,12.144 L8.203,12.144 L8.971,10.268 Z M25.046,10.346 L22.069,10.346 L22.069,11.173 L24.998,11.173 L24.998,12.412 L22.075,12.412 L22.075,13.334 L25.052,13.334 L25.052,14.073 L27.129,11.828 L25.052,9.488 L25.046,10.346 L25.046,10.346 Z M10.983,8.006 L14.978,8.006 L15.865,9.941 L16.687,8 L27.057,8 L28.135,9.19 L29.25,8 L34.013,8 L30.494,11.852 L33.977,15.68 L29.143,15.68 L28.065,14.49 L26.9
@asllanmaciel
asllanmaciel / meios-pagamentos-sprite.css
Created August 9, 2022 13:20
Métodos de Pagamentos (BR) com Sprite CSS
.visa {
background:url(https://i.imgur.com/43t9hpN.png) no-repeat -20px -19px;
width:64px;
height:37px
}
.master {
background:url(https://i.imgur.com/43t9hpN.png) no-repeat -93px -19px;
width:64px;
height:37px
@asllanmaciel
asllanmaciel / functions.php
Created July 20, 2022 22:04
Generate Featured Image From Url Raw
<?php
//WORDPRESS
//$image_url is the url of image you want to upload
//$post_id is the id of post which you need to add featured image
function generate_featured_image( $image_url, $post_id ){
$upload_dir = wp_upload_dir();
$image_data = file_get_contents($image_url);
$filename = basename($image_url);
if(wp_mkdir_p($upload_dir['path'])) $file = $upload_dir['path'] . '/' . $filename;
else $file = $upload_dir['basedir'] . '/' . $filename;