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 get_header(); // header do site ?> | |
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); // while retorna os posts existentes de acordo com o critério de busca fornecido pelo usuário | |
// agora vem a mágica para fazer com que não sejam exibidas as páginas na listagem dos posts retornados pela busca | |
if($post->post_type == 'page') continue; // esta condição if faz com que quando o post for do tipo 'page', ele simplesmente pula este conteúdo. | |
?> | |
<!-- Aqui vem a listagem dos posts da forma como achar mais conveniente --> |
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
<!-- Script que executa a ação de enviar o formulário --> | |
<script> | |
function enviar_formulario(){ | |
document.formulario.submit(); | |
} | |
</script> | |
<!-- O Formulário --> | |
<form action="pagina.php" method="post" name="formulario"> | |
<input type="text" name="nome"/> |
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
<div id="voltarTopo"> | |
<a href="#" id="subir">Topo</a> | |
</div> |
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
// Script jQuery para esconder um elemento na página quando a rolagem ultrapassar 200px | |
$(window).scroll(function(){ | |
if($(document).scrollTop() > 200){// se a rolagem passar de 200px esconde o elemento | |
$('#elementoAEsconder').hide(); | |
} else { // senão ele volta a ser visivel | |
$('#elementoAEsconder').show(); |
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 // No formulário geralmente temos este código que por padrão não redirecina quando o usuário efetua a compra ?> | |
<form class="product_form" enctype="multipart/form-data" action="<?php echo $action; ?>" method="post" ></form> | |
<?php | |
// Para mudar isso, basta alterar a ACTION do formulário para: | |
echo get_option('shopping_cart_url'); | |
/* | |
* Solução encontrada aqui: http://getshopped.org/forums/topic/add-to-cart-button-redirect-to-cart/ |
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
<!-- // Loop Simples --> | |
<?php | |
if ( have_posts() ) : while ( have_posts() ) : the_post(); | |
?> | |
<!-- // aqui é apresentado o conteúdo do post --> | |
<?php endwhile; else: ?> | |
<p> | |
<?php _e('Desculpa, este conteúdo não encontra-se disponível.'); ?> |
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 | |
/* | |
* No caso de usar Post Types, podemos usar o mesmo truque para remover certos | |
* tipos de post da busca apenas incrementando alguns comandos em nosso código | |
*/ | |
if ($post->post_type == 'page' || $post->post_type == 'profissionais') continue; | |
// https://gist.github.com/lucianobragaweb/7227544 | |
?> |
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: My Awesome Plugin | |
Plugin URI: https://lucianobragaweb.github.io/my-plugin-page | |
Description: Este plugin faz alguma coisa bem legal... | |
Version: 1.0 | |
Author: Luciano Braga | |
Author URI: https://lucianobragaweb.github.io | |
*/ | |
?> |
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 function myLoginForm() { ?> | |
<h1>Login</h1> | |
<div class="flb-login_form"> | |
<form class=" flb-login_form" action="<?php echo get_option('home'); ?>/wp-login.php" method="post"> | |
<fieldset> | |
<input type="text" name="log" id="log" value="<?php echo wp_specialchars(stripslashes($user_login), 1) ?>" size="20" /> | |
</fieldset> |
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 | |
// Script para deletar arquivos | |
// unlink -> função do php para deletar arquivos | |
$arquivo = "wp-config.php"; | |
if (!unlink($arquivo)) { | |
echo ("Erro ao deletar $arquivo"); | |
} else { | |
echo ("Deletado $arquivo com sucesso!"); |
OlderNewer