http://twitter.com/share?text=<TITLE>&url=<URL>
E.g. http://twitter.com/share?text=This+is+google+a+search+engine&url=https%3A%2F%2Fwww.google.com
http://www.facebook.com/sharer.php?u=&p[title]=
| /** | |
| * Detects if two elements are colliding | |
| * | |
| * Credit goes to BC on Stack Overflow, cleaned up a little bit | |
| * | |
| * @link http://stackoverflow.com/questions/5419134/how-to-detect-if-two-divs-touch-with-jquery | |
| * @param $div1 | |
| * @param $div2 | |
| * @returns {boolean} | |
| */ |
| <?php | |
| function wpEnqueueScripts(){ | |
| // Register styles | |
| wp_enqueue_style("style.css", get_stylesheet_directory_uri() . "/css/style.css"); | |
| // Unregister wordpress vertion of jquery and add our Latest version | |
| wp_deregister_script( 'jquery' ); | |
| wp_enqueue_script("jquery", get_stylesheet_directory_uri() . "/js/vendor/jquery.min.js"); |
| <?php | |
| /** | |
| * Check if an array is a multidimensional array. | |
| * | |
| * @param array $arr The array to check | |
| * @return boolean Whether the the array is a multidimensional array or not | |
| */ | |
| function is_multi_array( $x ) { | |
| if( count( array_filter( $x,'is_array' ) ) > 0 ) return true; | |
| return false; |
| <?php | |
| $url = 'http://server.com/path'; | |
| $data = array('key1' => 'value1', 'key2' => 'value2'); | |
| // use key 'http' even if you send the request to https://... | |
| $options = array( | |
| 'http' => array( | |
| 'header' => "Content-type: application/x-www-form-urlencoded\r\n", | |
| 'method' => 'POST', | |
| 'content' => http_build_query($data), |
| $.urlParam = function(name){ | |
| var results = new RegExp('[\?&]' + name + '=([^]*)').exec(window.location.href); | |
| if (results==null){ | |
| return null; | |
| } | |
| else{ | |
| return results[1] || 0; | |
| } | |
| } |
| // WORDPRESS function to get the sibling ID of a given post | |
| // this was created to avoid using a repetition patern like: | |
| // $current = $post->ID; | |
| // $parent = $post->post_parent; | |
| // $get_grandparent = get_post($parent); | |
| // $grandparent = $get_grandparent->post_parent; | |
| // $get_greatgrandparent = get_post($grandparent); | |
| // $greatgrandparent = $get_greatgrandparent->post_parent; | |
| // Like described in: http://andyweigel.com/great-grand-parent-ids-in-wordpress/ |
| { | |
| "esversion": 6 | |
| } |