Skip to content

Instantly share code, notes, and snippets.

View celsofabri's full-sized avatar
👾
The truth is dubious

Celso Fabri Junior celsofabri

👾
The truth is dubious
View GitHub Profile
@fernandofuly
fernandofuly / limit-sticky-posts.php
Last active October 29, 2015 14:40
Limit Number of Sticky Posts to Show
<?php
$sticky = get_option( 'sticky_posts' );
/* Sort the newest one at the top */
rsort( $sticky );
/* Get the 2 newest stickies (change 2 for a different number) */
$sticky = array_slice( $sticky, 0, 2 );
/* Query Post */
@cezarsmpio
cezarsmpio / functions.php
Last active August 3, 2016 04:08
Wordpress - Get the post terms
<?php
/**
* Get the terms of specific post in a list
* @param object $p The post
* @param array $params An array of params
* @return string The HTML result
*/
function get_post_terms($p, $params = array()) {
$defaults = array(
@cezarsmpio
cezarsmpio / css.js
Created August 24, 2016 16:29
Add CSS with object
HTMLElement.prototype.css = function (style) {
for (let k in style) {
this.style[k] = style[k];
}
};
// Example 1
document.body.css({
backgroundColor: 'rgb(20,20,20)',
fontFamily: 'Arial, sans-serif',