SUBBUINDESIGN Blog

How to unsubscribe from spam e-mails?

With 2012 just round the corner, you might be planning on being efficient with the time you spend in your inbox in 2012. If that’s the case, today’s post should prove helpful! In this...

How to Download Themes from CMS Made Simple?

Download themes for CMS Made Simple, you can use with the Theme Manager. These themes are uploaded here are contributed by independant third parties as a free service. The CMS Made Simple project make...

How to target Specific Browsers?

To Target Specific Browsers: #ID or .class is like div#main or div.main * html #ID or .class { ie6 } NOTE: sometimes IE6 requires… * html body #ID or .class { ie6 } *:first-child+html #ID or .class { ie7 } #ID...

How to Underline Individual Words with jQuery?

There is no CSS for applying an underline (text-decoration: underline;) only to individual words in a multiple-word element. The best way would be to wrap each word in a span (not the spaces, just...

How to Turn on WordPress Error Reporting?

Comment out the top line there, and add the rest to your wp-config.php file to get more detailed error reporting from your WordPress site. Definitely don’t do this live, do it for local development and testing....

Working with Attributes using jQuery

Setting Single Attribute $(“img”).attr(“src”, “/images/banner.jpg”); Setting Single Attribute (with function) $(“div”).attr(“id”, function (arr) { return “div-id” + arr; }) Setting Multiple Attributes $(“img”).attr({ src: “/images/banner.jpg”, title: “banner”, alt: “banner” }); Getting Attribute var $source...

Useful tips about Custom Fields in wordpress

Dump out all custom fields as a list <?php the_meta(); ?> Display value of one specific custom field <?php echo get_post_meta($post->ID, ‘mood’, true); ?> “mood” would be ID value of custom field Display multiple...

How to write Style Placeholder Text?

Placeholder text in inputs has (in the browsers implementing it so far) a light gray color. To style it, you’ll need vendor prefix CSS properties. ::-webkit-input-placeholder { color: red; } :-moz-placeholder { /* Firefox...

How to Turn Off Number Input Spinners?

WebKit desktop browsers add little up down arrows to number inputs called spinners. You can turn them off visually like this: input[type=number]::-webkit-inner-spin-button, input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

How to get Transparent Inside Border?

HTMl <div class=”inner-border”> Transparent Inside Border </div> CSS .inner-border { background: #000; color: #fff; margin: 50px; padding: 15px; position: relative; } .inner-border:before { border: 5px solid #000; content: “”; position: absolute; top: -10px; bottom:...

How to get Gradient Underlines?

a { position: relative; padding-bottom: 6px; } a:hover::after{ content: “”; position: absolute; bottom: 2px; left: 0; height: 1px; width: 100%; background: #444; background: -webkit-gradient(linear, left top, right top, color-stop(0%,transparent), color-stop(50%,#444), color-stop(100%,transparent)); background: -webkit-linear-gradient(left, transparent...

How to create Gradient Text with CSS3?

This is WebKit only, but is the cleanest way to accomplish it as the text remains editable and selectable web text. h1 { font-size: 72px; background: -webkit-linear-gradient(#eee, #333); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }  

How to create Current Page with JavaScript?

This is like a replacement for PHP’s SCRIPT_NAME with JavaScript. location.href.split(‘/’).pop(); For example with this URL: http://css-tricks.com/examples/ScriptName/index.php This code: document.write( location.href.split(‘/’).pop() ); Would write to the page: “index.php” Reference URL

How to disable javascript in web browser?

JavaScript is supported by the Camino, Firefox, Google Chrome, iCab, Internet Explorer, Konqueror, Netscape, OmniWeb, Opera, Safari and SeaMonkey Web browsers, and so almost everyone can use it. However, some people worry that JavaScript...

How to Find ID of Top-Most Parent Page?

This will find what the ID is of the top-most parent Page, in a nested child page. For example, this page you are literally looking at is nested under <?php if ($post->post_parent) { $ancestors=get_post_ancestors($post->ID);...

How to get Line-On-Sides Headers?

The post mockup was this: I coded up one way to do it which works, but isn’t quite perfect. I figured I’d post it here and you all could chime in with better ways...

How to Find All Links on a Page using PHP

$html = file_get_contents(‘http://www.example.com’); $dom = new DOMDocument(); @$dom->loadHTML($html); // grab all the on the page $xpath = new DOMXPath($dom); $hrefs = $xpath->evaluate(“/html/body//a”); for ($i = 0; $i < $hrefs->length; $i++) { $href = $hrefs->item($i);...

How to Detect IE5 or IE6 using php code

PHP CODE: function getMSIE6() { $userAgent = strtolower($_SERVER[“HTTP_USER_AGENT”]); if (ereg(“msie 6”, $userAgent) || ereg(“msie 5”, $userAgent)) { return true; } return false; }

How to Drag an element without jQuery UI

It doesn’t have all the fancy callbacks and options, but hey, it makes things draggable (and with a specified handle optionally). (function($) { $.fn.drags = function(opt) { opt = $.extend({handle:””,cursor:”move”}, opt); if(opt.handle === “”)...

How to Detect AJAX Request using php

The HTTP_X_REQUESTED_WITH header is sent by all recent browsers that support AJAX requests. if ( !empty($_SERVER[‘HTTP_X_REQUESTED_WITH’]) && strtolower($_SERVER[‘HTTP_X_REQUESTED_WITH’]) == ‘xmlhttprequest’ ) { # Ex. check the query and serve requested data

How to Display Only First X Divs, Toggle Rest

var news = 2; hidenews = “- Hide news archive”; shownews = “+ Show news archive”; $(“.archive”).html( shownews ); $(“.news:not(:lt(“+news+”))”).hide(); $(“.archive”).click(function (e) { e.preventDefault(); if ($(“.news:eq(“+news+”)”).is(“:hidden”)) { $(“.news:hidden”).show(); $(“.archive”).html( hidenews ); } else {...

How to make Transitional Interfaces, Coded using CSS3

It’s a quick read that that drives home a great point. Transitions and animations can be more than eye candy. They can help give your brain a clue about what is happening on a...

What is the iPad Orientation CSS code?

<link rel=”stylesheet” media=”all and (orientation:portrait)” href=”portrait.css”> <link rel=”stylesheet” media=”all and (orientation:landscape)” href=”landscape.css”>

How to Fire Event When User is Idle using jQuery

See the two commented lines below, that is where you can insert code for things to do when the user goes idle, and when the user comes back. Set the idle period on the...