This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Get first paragraph from a WordPress post. Use inside the Loop. | |
* | |
* @param $class string optional class name to include in the paragraph | |
* @return string | |
*/ | |
function get_first_paragraph( $class = '' ){ | |
global $post; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Get all but the first paragraph from a WordPress post. Use inside the Loop. | |
* | |
* @author Mauricio Gelves <[email protected]> | |
* @return string | |
*/ | |
function get_all_but_first_paragraph( ) { | |
global $post; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(function() { | |
$('a[href*="#"]:not([href="#"])').click(function() { | |
if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) { | |
var target = $(this.hash); | |
target = target.length ? target : $('[name=' + this.hash.slice(1) +']'); | |
if (target.length) { | |
$('html, body').animate({ | |
scrollTop: target.offset().top | |
}, 1000); | |
return false; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Get the latest hierarchical taxonomy children of a post | |
* | |
* @author Mauricio Gelves <[email protected]> | |
* @param $post_id int Post ID | |
* @return array | |
*/ | |
function get_last_children_taxonomy_in_post( $post_id, $taxonomy = 'category'){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Crop a text to a specific word count | |
* | |
* @author Mauricio Gelves <[email protected]> | |
* @param $text_to_trim string | |
* @param $wordcount int | |
* @param $final string Which string do you want to add at the final of the trimmed text? | |
* @return string | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Estando aquí en Santander, | |
yo mi poema os relato, | |
Y quisiera en este rato, | |
expresar mi admiración, | |
por tan gran contribución, | |
de anónimos usuarios, | |
que sin lucro desarrollan, | |
WordPress y su base de datos. | |
La conforman doce tablas, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function url_origin( $s, $use_forwarded_host = false ) | |
{ | |
$ssl = ( ! empty( $s['HTTPS'] ) && $s['HTTPS'] == 'on' ); | |
$sp = strtolower( $s['SERVER_PROTOCOL'] ); | |
$protocol = substr( $sp, 0, strpos( $sp, '/' ) ) . ( ( $ssl ) ? 's' : '' ); | |
$port = $s['SERVER_PORT']; | |
$port = ( ( ! $ssl && $port=='80' ) || ( $ssl && $port=='443' ) ) ? '' : ':'.$port; | |
$host = ( $use_forwarded_host && isset( $s['HTTP_X_FORWARDED_HOST'] ) ) ? $s['HTTP_X_FORWARDED_HOST'] : ( isset( $s['HTTP_HOST'] ) ? $s['HTTP_HOST'] : null ); | |
$host = isset( $host ) ? $host : $s['SERVER_NAME'] . $port; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* ACF Responsive Image function | |
* Set your image field to return a WordPress array and call this function | |
* to generate a responsive <img> tag with srcset attributes | |
* You can also override the 'alt', 'class', 'size' and 'style' attributes. | |
* | |
* | |
* Example of use: | |
* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// 1. Configurar el PATH hacia la nueva carpeta de ACF | |
function configurar_path_a_acf( $path ) { | |
// actualizar el path | |
$path = get_stylesheet_directory() . '/acf/'; | |
return $path; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// 1. Declaro el include a la librería TGM Plugin Activation | |
include_once __DIR__ . "/inc/lib/class-tgm-plugin-activation.php"; | |
/** | |
* 2. En la acción 'tgmpa_register' declaro las dependencias del plugin | |
* siguiendo las pautas de la documentación oficial: | |
* http://tgmpluginactivation.com/configuration/ | |
*/ |
OlderNewer