Skip to content

Instantly share code, notes, and snippets.

View mestrewp's full-sized avatar

Mestre WordPress mestrewp

View GitHub Profile
@mestrewp
mestrewp / CTP_custom_post_per_page.php
Created May 28, 2012 18:29
CTP custom post per page
<?php
// Posts per page on CPT
function cs_custom_posts_per_page_CPT( $query ) {
switch ( $query->query_vars['post_type'] ) {
case 'album-de-fotos':
$query->query_vars['posts_per_page'] = 9;
break;
case 'loja':
$query->query_vars['posts_per_page'] = 15;
break;
@mestrewp
mestrewp / EmptyWidget.php
Created May 28, 2012 18:29
Plugin code to create a single widget in wordpress.
<?php
/**
* @package RedRokk
* @version 1.0.0
*
* Plugin Name: Empty Widget
* Description: Single Widget Class handles all of the widget responsibility, all that you need to do is create the html. Just use Find/Replace on the Empty_Widget keyword to rebrand this class for your needs.
* Author: RedRokk Interactive Media
* Version: 1.0.0
* Author URI: http://www.redrokk.com
@mestrewp
mestrewp / gist:2820526
Created May 28, 2012 18:29
WordPress - Configurando constantes para acesso ao FTP pelo WordPress
<?php
/**
* @author marcelo toscano <[email protected]>
* Essas configurações vão dentro dentro do wp-config.php
*/
//define o usuário
define('FTP_USER','usuario');
//define a senha
define('FTP_PASS','senha');
//define qual seu host
@mestrewp
mestrewp / require wp-config
Created May 28, 2012 18:29
Se você esta escrevendo um programa fora da estrutura padrão do wordpress e precisa conectar ao banco de dados, não esquece que requerer este três arquivos
<?php
include_once("wp-config.php");
include_once("wp-load.php");
include_once("wp-includes/wp-db.php");
?>