Skip to content

Instantly share code, notes, and snippets.

View lunaroja's full-sized avatar

Abraham Velazquez Tello lunaroja

View GitHub Profile
@lunaroja
lunaroja / no-plugin-updates-notifications.php
Created July 23, 2013 19:21
WordPress: Do not show plugin update notifications
function run_chk_usr_lvl($matches) {
global $userdata;
if (!current_user_can('update_plugins')) {
remove_action('admin_notices', 'update_nag', 3);
remove_action( 'load-update-core.php', 'wp_update_plugins' );
}
}
add_filter('pre_site_transient_update_plugins', create_function( '$a', "return null;" ));
add_action('admin_init', 'run_chk_usr_lvl');
@lunaroja
lunaroja / wp-query-events-orderby-date.php
Created August 14, 2013 06:10
Wordpress Query using custom fields with Meta Box (http://wordpress.org/plugins/meta-box/) date fields to sort.
<?php $query = "
SELECT * FROM $wpdb->posts
LEFT JOIN $wpdb->postmeta ON($wpdb->posts.ID = $wpdb->postmeta.post_id)
WHERE ($wpdb->posts.post_status = 'publish') AND
($wpdb->postmeta.meta_key = 'event_start_time')
ORDER BY $wpdb->postmeta.meta_value ASC";
$events = $wpdb->get_results($query, OBJECT);
?>
<?php if ($events): foreach ($events as $post): ?>
<?php get_template_part( 'loop', 'event' ); ?>
{
"replacements": {
"nbsp": { "find": "&nbsp;", "replace": " ", "greedy": true, "case": false },
"remove_json_dangling_commas": {
"find": ",([\\r\\n\\s]*)(\\]|\\})",
"replace": "\\1\\2",
"greedy": true,
"scope_filter": ["-string", "-comment"]
@lunaroja
lunaroja / visibility-classe.scss
Created September 14, 2013 00:41
Foundation Visibility Classes
#visibility-classes {
position: fixed;
display: block;
top: 0;
left: 0px;
color: #FFF;
z-index: 1000;
font-size: 10px;
span {
padding: 5px;
@lunaroja
lunaroja / wp-clean-header.php
Created December 9, 2013 18:57
Clean WordPress wp_head() output
<?php
if ( ! function_exists( 'clean_header' ) ):
/*
* Clean the WordPress Header
*/
function clean_header() {
@lunaroja
lunaroja / wp-google-search.php
Created December 11, 2013 01:28
Switch out WordPress Search for Google Domain Search
if ( ! function_exists( 'google_search_form' ) ) :
function google_search_form( $form ) {
$form = '<form method="get" action="http://www.google.com/search" class="search">';
$form .= '<input type="hidden" name="domains" value="' . get_bloginfo('url') . '">';
$form .= '<input type="hidden" name="sitesearch" value="' . get_bloginfo('url') . '">';
$form .= '<input type="text" name="q" placeholder="Search" class="input">';
$form .= '<input type="submit" value="Submit" class="submit">';
$form .= '</form>';
return $form;
@lunaroja
lunaroja / link-helpers.js
Last active December 31, 2015 17:09
Clean Link Helpers
@lunaroja
lunaroja / retina.scss
Created December 20, 2013 07:31
Retina Mixin
@mixin retina() {
@media only screen and (-webkit-min-device-pixel-ratio: 1.25),
only screen and (min-resolution: 120dpi) {
@content;
}
}
.icon {
background-size: 200px 40px;
background-image: url(img/icons.png);
@lunaroja
lunaroja / functions.php
Last active August 29, 2015 14:08
WP: Temp redirect non logged in users to other URL.
<?php
if (
!in_array($GLOBALS['pagenow'], array('wp-login.php', 'wp-register.php'))
&& !is_admin()
&& !is_user_logged_in()
) {
wp_redirect( 'http://other-temp-site.com/', 302 ); exit;
}
@lunaroja
lunaroja / player.html
Created January 20, 2015 07:48
iTunes Style Play Button
<div class="player">
<button class="button-play ion-stop">
<div class="play-crop" data-anim="play-base play-crop">
<div class="play-circle" data-anim="play-base play-left"></div>
<div class="play-circle" data-anim="play-base play-right"></div>
</div>
</button>
</div>