Skip to content

Instantly share code, notes, and snippets.

@CEscorcio
CEscorcio / related articles
Created October 11, 2013 09:57
Articles from the same category (kind a related articles)
@CEscorcio
CEscorcio / new_gist_file
Created October 4, 2013 12:48
Imprimir menu pai da pagina
<?php if ($post->post_parent) {
$ancestors=get_post_ancestors($post->ID);
$root=count($ancestors)-1;
$parent = $ancestors[$root];
} else {
$parent = $post->ID;
}
$children = wp_list_pages("title_li=&child_of=". $parent ."&echo=0");
// if there are children, this is the resulting content output
@CEscorcio
CEscorcio / new_gist_file
Created October 4, 2013 11:29
Contenação de php variaveis com html
<div class='rpfec_box' style='width:".$width."'>
@CEscorcio
CEscorcio / Change the_excerpt lenght
Created September 10, 2013 07:58
Limit first 100 letters in post instead the default the_excerpt lenght
<?php
$string = $post->post_content;
$newString = substr($string, 0, 100);
echo $newString;
?>
@CEscorcio
CEscorcio / new_gist_file
Created September 8, 2013 18:03
Wordpress Git .ignore
# This is a template .gitignore file for git-managed WordPress projects.
#
# Fact: you don't want WordPress core files, or your server-specific
# configuration files etc., in your project's repository. You just don't.
#
# Solution: stick this file up your repository root (which it assumes is
# also the WordPress root directory) and add exceptions for any plugins,
# themes, and other directories that should be under version control.
#
# See the comments below for more info on how to add exceptions for your
@CEscorcio
CEscorcio / htaccess.snippets
Created August 28, 2013 14:48
.htaccess wordpress from boilarplate
# Apache Server Configs v2.2.0 | MIT License
# https://github.com/h5bp/server-configs-apache
# (!) Using `.htaccess` files slows down Apache, therefore, if you have access
# to the main server config file (usually called `httpd.conf`), you should add
# this logic there: http://httpd.apache.org/docs/current/howto/htaccess.html.
# ------------------------------------------------------------------------------
@CEscorcio
CEscorcio / Plugin Fade out and remover
Created August 20, 2013 09:04
Plugin to fadeout and remover
jQuery.fn.fadeOutAndRemove = function(speed){
$(this).fadeOut(speed,function(){
$(this).remove();
})
}
// And then: Somewhere in the program code.
$('div').fadeOutAndRemove('fast');
@CEscorcio
CEscorcio / wp-config
Created August 6, 2013 07:26
Debug WordPress
define('WP_DEBUG', true);
define('WP_DEBUG_LOG', true);
define('WP_DEBUG_DISPLAY', false);
@ini_set('display_errors', 0);
@CEscorcio
CEscorcio / Robots
Created August 2, 2013 13:21
Robots.txt for Wordpress
Disallow: /cgi-bin/
Disallow: /wp-admin/
Disallow: /wp-includes/
Disallow: /wp-content/plugins/
Disallow: /wp-content/cache/
Disallow: /wp-content/themes/
Allow: /wp-content/uploads/
@CEscorcio
CEscorcio / navigation
Created August 1, 2013 13:48
How to add navigation to a blog
$paged = get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 1; // setup pagination
$the_query = new WP_Query( array(
'post_type' => 'clients',
'paged' => $paged,
'posts_per_page' => 5)
);
while ( $the_query->have_posts() ) : $the_query->the_post();
echo '<div>' . get_the_title() . '</div>';