Checking if string contains numbers
is_numeric doesnt check strings for numbers. You need to use preg_match('#[0-9]#',$string)
is_numeric doesnt check strings for numbers. You need to use preg_match('#[0-9]#',$string)
If you are using “page-template”s you’ll have problems with pagination since pages are not meant to display posts and some people frown upon using page-templates for custom archive display, but it’s sometimes the simplest way. Anyway the solution is 1.) to nullify the global $wpquery 2.) adding ‘paged’ => $paged arg. before displaying your posts…
When your content area is smallar then your offcanvas menu you’ll get double-rainbowed. To prevent this simply remove either body | html from the following rule in offcanvas.css /* * Style tweaks * ————————————————– */ html, body { overflow-x: hidden; /* Prevent scroll on narrow devices */ } so that it reads: body { overflow-x:…
Ways to load an array from file into a variable: 1- $var = require ‘myarray.php’; // or include // myarray.php contents return array(“test”,”test2″); 2 – require ‘myarray.php’; // or include // myarray.php contents $var = array(“test”,”test2″); Use $var as you would normally. 3- $var = file_get_contents(‘myarray.php’); // myarray.php contents array(“test”,”test2″);
Always check for local time Despite the fact that my server timezone was set correctly, somehow time() was giving wrong ( UTC) hour. So i ended up using wp’s functions to make sure. $now = current_time( ‘timestamp’, 0 ) ;$local_ts = get_the_time(‘U’,$post->ID);
I’ve been pulling my hair why my custom cursor wouldnt work. Turns out, IE (yes, big surprise) takes site url instead of stylesheet as baseurl when it comes to cursors.
There are mb_strlen() and mb_substr() for multibyte characters however there is no mb_str_word_count. Hence my previous post.