Skip to content

Instantly share code, notes, and snippets.

liderdesarrollo

View GitHub Profile
View gist:5176eb63d858cd22d5b5
//Simple WPQuery filter by category Slug
<?php
wp_reset_postdata();
$args = array(
'category_name' => 'actualidad',
'orderby' => 'date',
'post_type' => 'post',
'posts_per_page' => -1
);
@liderdesarrollo
liderdesarrollo / gist:3ccbb7c9e7c7a1c21787
Created Mar 25, 2015
obtener el contenido por id del post
View gist:3ccbb7c9e7c7a1c21787
<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>' );
?>
View gist:0696634db085c3dcb4c7
$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 {
View PhoneNumberUtil.php
<?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>.
You can’t perform that action at this time.