Pages

Thursday, January 19, 2017

Wordpress using wrong template after AJAX loading

A tricky problem with my AJAX-search function. WordPress decided to use front-page.php for loading extra AJAX-content. The problem was that this styled the content in a different way than I needed. After identifying the root of the problem (which takes time!), I looked around for a neat solution. What I came up with was overriding the template hierarchy in case the request URL contains a “?” (which means we are searching). This is not a universal solution but it works for me. Add the following to your functions.php function ccb_template_override($template) { if( strpos($_SERVER['REQUEST_URI'],"?")!==false ) { return locate_template('search.php'); } return $template; } add_filter('template_include', 'ccb_template_override'); For a better solution that applies to all AJAX-loaded...

Wednesday, January 18, 2017

#TechCelebs

Chuck XORris, JK SIMmons, Alec Baldwindows, Bob DylLAN, George Cloney, Matt Damonitor, Prinstagram, Brad Pinterest TechCelebs silly — Kamiel Choi (@kamiel79) January 18, 2017 ...

Wednesday, December 30, 2015

Meteor

I played around with meteor yesterday and I have mixed feelings. First of all, I was impressed that the whole plaform (it is not just a framework but an end-to-end development platform for all devices and browsers that matter because of the power of JavaScript). It worked out of the box on my Windows machine and it deployed out of the box to the site (http://happy2016.meteor.com/). I watched some videos about meteor and I like their bottom line of bringing to the world what Facebook and Google have been hiding from us for their revenue. Fast interactive (reactive) web technologies. There are a few things that make me skeptical as to whether meteor is the future. First of all, do we really want to code in Javascript? I have found debugging a minor application to be a nightmare,...

Tuesday, December 22, 2015

jQuery UI style hack

Some of us still use jQuery UI In fact, it wasn’t too bad, is still supported by all modern browsers, and performs reasonably well on mobile. There is one issue: the graphics look horribly 2010. jQuery UI offers a user interface to cherrypick your own CSS (it’s great and kind of works: look at their themeroller here. Still, it doesn’t let you replace the .png icons with font icons (fontawesome, dashicons). I didn’t feel like overhauling the thing so I came up with a simple hack that works for me (on this site): .ui-corner-all { border-radius:0!important} .ui-state-hover {border:0!important;background:transparent!important} .ui-widget-header...

Sunday, December 20, 2015

Bob the Builder likes women with brick tits. ...

Tuesday, December 8, 2015

Weekly changing random number

Simple task: How do we generate a random number that automatically changes every certain period of time. Of course, we use the week number when calculating the random number. Also, we have to cache a “large integer” that will not change until the end of the week to get a deterministic random-enough number. The result can look something like this when we integrate it in a WordPress menu and we only take into account the tags with a minimum number of posts. $the_tags = get_tags(); foreach ($the_tags as $t) { if ($t->count>INFOCUS_MIN) $ft[] = $t; } $tag = $ft[abs(SOME_LARGE_INTEGER * date(“W”) % sizeof($ft))]; $link = get_tag_link($tag->term_id); $infocus = ‘<li id=”menu-item-featured-tag” class=”menu-item”><a href=”‘.$link.'”>’ . __(‘In focus: ‘) . $tag->name.'</a></li>’;...

Wednesday, October 21, 2015

Gmail notification only for important mails

Some e-mails are more important than others. As a freelance writer/web designer/translator I often get time critical messages. I want to get an email notification with a sound alarm and a vibration for those, but not for all my mail (my phone would be abuzz continuously). So I found this useful article on how-to geek. It is free and really simple to set up in gmail. You basically add a filter label and set your notifications only for that label in Android (the label needs to be created on a pc though). Gmail notification is just a part of the puzzle for freelancers, especially those who want to be the first to respond to job offers. ...
Page 1 of 1412345Next

 
Design by Free WordPress Themes | Bloggerized by Lasantha - Premium Blogger Themes | Lady Gaga, Salman Khan