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 | |
// source: http://cubiq.org/the-perfect-php-clean-url-generator | |
// author: Matteo Spinelli | |
// MIT License / http://creativecommons.org/licenses/by-sa/3.0/ (please re-check at source) | |
setlocale(LC_ALL, 'en_US.UTF8'); | |
function toAscii($str, $replace=array(), $delimiter='-') { | |
if( !empty($replace) ) { | |
$str = str_replace((array)$replace, ' ', $str); | |
} |
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 theme_autoset_featured_image($post_ID) { | |
// Verifica se o arquivo enviado e uma imagem | |
if (!wp_attachment_is_image($post_ID)) | |
return; | |
// Vamos pegar os dados do arquivo para | |
// termos acesso à ID do post ao qual foi enviado | |
$post = get_post($post_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
git checkout master | |
git branch | |
echo '### PRODUÇÃO REPORT ###' | |
git status | |
echo '++++++++++++++++++++++' | |
echo 'Deseja fazer o deploy [s/n]?' | |
read deploy | |
echo '++++++++++++++++++++++' |
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 depois_the_content( $content ) { | |
global $post; | |
$content .= 'Isso vai aparecer depois do conteúdo'; | |
return $content; | |
} | |
add_filter( 'the_content', 'depois_the_content' ); |
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 | |
/* | |
Enviar e-mail para o administrador se houver posts para revisão | |
Dicas do @GugaAlves (@tudoparawp): | |
- Adicionar link para enviar e-mail diretamente para o administrador; | |
- Incluir link para a edição do post no admin, facilitando a vida do admin que receber este email. | |
Dicas do Gustavo Bordoni (@webord): | |
- incluir na função o $post (objeto para WP_Query) para não ficar passando o $post_id a cada save; |
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 | |
/** | |
* Arquivo para criação de CPTs e Taxonomias | |
* | |
*/ | |
// CPT Labs | |
$create_cpt->cpt( array( | |
'slug' => 'labs', | |
'name' => 'Labs', |
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 | |
/** | |
* @param $query - (required) Query utilizada para o loop. Se for uma query personalizada, passe o objeto. Senão, passe $wp_query | |
* @param $baseURL - (optional) URL a partir de onde a paginação deve ser feita. | |
* | |
*/ | |
function pagination( $query, $baseURL = '' ) { | |
if ( ! $baseURL ) $baseURL = get_bloginfo( 'url' ); | |
$page = $query->query_vars["paged"]; | |
if ( !$page ) $page = 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
<?php | |
define('MPDF_PATH', 'class/mpdf/'); | |
include(MPDF_PATH.'mpdf.php'); | |
$mpdf=new mPDF(); | |
$mpdf->WriteHTML('Hello World'); | |
$mpdf->Output(); | |
exit(); |
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( window, document, $ ) { | |
var obj = function() { | |
}; | |
})( window, document, jQuery ); |
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
<section> | |
<h1>Posts do blog</h1> | |
<article> | |
<h1>Título do artigo</h1> | |
<p>Resumo do artigo</p> | |
</article> | |
<article> | |
<h1>Título do artigo</h1> |
OlderNewer