ben(ny) pearson|

PHP array_merge

Merges the elements of one or more arrays together so that the values of one are appended to the end of the previous one, and returns the resulting array eg. <?php $array1 = array(“color” => “red”, 2, 4); $array2 = array(“a”, “b”, “color” => “green”, “shape” => “trapezoid”, 4); $result = array_merge($array1, $array2); print_r($result); ?> […]

Using jQuery in WordPress

Loading the jQuery that comes with WordPress Add this PHP code to header.php before wp_head() <?php wp_enqueue_script( ‘jquery’ ); ?> What not to do – Using a Google served jQuery instead Add this PHP code to functions.php but make sure it’s the latest version. <?php function my_scripts_method() { wp_deregister_script( ‘jquery’ ); wp_register_script( ‘jquery’, ‘http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js’); wp_enqueue_script( […]

PHP continue

continue is used within looping structures to skip the rest of the current loop iteration and continue execution at the condition evaluation and then the beginning of the next iteration. A basic example that prints “13”, skipping over 2. $arr = array( 1, 2, 3 ); foreach( $arr as $number ) { if( $number == […]