Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / related articles
Created October 11, 2013 09:57
Articles from the same category (kind a related articles)
@CEscorcio
CEscorcio / top categories
Created November 8, 2013 09:10
will restrict category links to top level cats only.
<?<?php wp_list_categories('title_li=&depth=1'); ?>
@CEscorcio
CEscorcio / product_category_list.php
Created November 15, 2013 12:34
LIst all categories in wooCommerce
<?php
$args = array( 'taxonomy' => 'product_cat' );
$terms = get_terms('product_cat', $args);
$count = count($terms); $i=0;
if ($count > 0) {
foreach ($terms as $term) {
$i++;
$term_list .= '<li><a href="/categoria/' . $term->slug . '" title="' . sprintf(__('View all post filed under %s', 'my_localization_domain'), $term->name) . '">' . $term->name . '</a></li>';
@CEscorcio
CEscorcio / hover jquery
Created December 1, 2014 17:56
hover dinamico com jquery
$(".icone").hover(function(){
$(this).attr("src", function(index, attr){
return attr.replace(".png", "_0.png");
});
}, function(){
$(this).attr("src", function(index, attr){
return attr.replace("_1.png", ".png");
});
});
<?php
$app_id = "[YOUR APP ID]";
$canvas_page = "[YOUR APP URL]";
$auth_url = "http://www.facebook.com/dialog/oauth?client_id="
. $app_id . "&redirect_uri=" . urlencode($canvas_page);
$signed_request = $_REQUEST["signed_request"];
@CEscorcio
CEscorcio / gist:af705bb18128fdfa750b
Created December 15, 2015 12:29
PreHeader Snippet
<td style="display:none !important; visibility:hidden; opacity:0; color:transparent; height:0; width:0; mso-hide:all; line=height:0px; font-size:0px">Your preheader here</td>
<a href="http://www.linkedin.com/shareArticle?mini=true&amp;title=<?php the_title(); ?>&amp;url=<?php the_permalink(); ?>" title="Share on LinkedIn">Linkedin</a>
<a href="https://plus.google.com/share?url=<?php the_permalink(); ?>" onclick="javascript:window.open(this.href,
'', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=600,width=600');return false;">G+</a>
<a href="http://twitter.com/home/?status=<?php the_title(); ?> - <?php the_permalink(); ?>" title="Tweet this!">TWEET</a>
<a href="http://www.facebook.com/sharer.php?u=<?php the_permalink();?>&amp;t=<?php the_title(); ?>" title="Share on Facebook.">SHARE FACEBOK</a>
@CEscorcio
CEscorcio / gist:3895a5845d020b9d68120c36d68de74f
Created July 25, 2016 09:05
WP Custom Type - Related Articles
<?php
// You might need to use wp_reset_query();
// here if you have another query before this one
global $post;
$current_post_type = get_post_type( $post );
// The query arguments