Skip to content

Instantly share code, notes, and snippets.

<?php
namespace libphonenumber;
/**
* Utility for international phone numbers. Functionality includes formatting, parsing and
* validation.
*
* <p>If you use this library, and want to be notified about important changes, please sign up to
* our <a href="http://groups.google.com/group/libphonenumber-discuss/about">mailing list</a>.
@liderdesarrollo
liderdesarrollo / gist:0696634db085c3dcb4c7
Created March 25, 2015 04:12
Paginador wordpress manual
$total = $the_query->max_num_pages;
// only bother with the rest if we have more than 1 page!
if ( $total > 1 ) {
// get the current page
if ( !$current_page = get_query_var('paged') )
$current_page = 1;
// structure of "format" depends on whether we're using pretty permalinks
if( get_option('permalink_structure') ) {
$format = '?paged=%#%';
} else {
@liderdesarrollo
liderdesarrollo / gist:3ccbb7c9e7c7a1c21787
Created March 25, 2015 04:28
obtener el contenido por id del post
<div class="post-resume">
<?php
$my_postid = get_the_ID();//This is page id or post id
$content_post = get_post($my_postid);
$content = $content_post->post_content;
$content = apply_filters('the_content', $content);
$content = str_replace(']]>', ']]&gt;', $content);
echo wp_trim_words( $content, 40, '<a href="'. get_permalink() .'"> ...Read More</a>' );
?>
//Simple WPQuery filter by category Slug
<?php
wp_reset_postdata();
$args = array(
'category_name' => 'actualidad',
'orderby' => 'date',
'post_type' => 'post',
'posts_per_page' => -1
);