Update: please note that I have since switched to using a set of bash scripts instead of poluting the Git repository with git svn.
Author: Kaspars Dambis
kaspars.net / @konstruktors
| function get_image_attachments( $size = 'thumbail', $ID ) { | |
| $featured_image_id = get_post_thumbnail_id( $ID ); | |
| $args = array( | |
| 'post_type' => 'attachment', | |
| 'post_mime_type' => 'image', | |
| 'numberposts' => -1, | |
| 'orderby' => 'menu_order', | |
| 'order' => 'ASC', | |
| 'post_parent' => $ID, | |
| 'exclude' => $featured_image_id |
| <?php | |
| // Twitter date format example: "created_at": "Mon Jun 27 19:32:19 +0000 2011" | |
| function from_apachedate( $date ) { | |
| list( $D, $M, $d, $h, $m, $s, $y ) = sscanf( $date, "%s %s %2d %2d:%2d:%2d +0000 %4d" ); | |
| return strtotime( "$d $M $y $h:$m:$s" ); | |
| } | |
| // human_time_diff is a WordPress function | |
| echo human_time_diff( from_apachedate( $item->created_at ), current_time( 'timestamp' ) ); |
| <?php | |
| if(preg_match('/vimeo/', $data['url'])){ | |
| $url = '//player.vimeo.com/video/'.end(explode('/', $data['url'])); | |
| echo "<iframe src='$url' width='560' height='315' frameborder='0' webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>"; | |
| echo "<img src='".unserialize(file_get_contents("http://vimeo.com/api/v2/video/".end(explode('/', $data['url'])).".php"))[0]['thumbnail_medium']."' />"; |
| <?php | |
| // gets the ID from a custom field to show posts on a specific page | |
| $buildType = get_post_meta($post->ID, 'build_type_id', true); | |
| // run query | |
| query_posts(array( | |
| 'post_type' => 'portfolio', | |
| 'showposts' => -1, | |
| 'tax_query' => array( | |
| array( |
| <?php | |
| //Simple Ajax Login Form | |
| //Source: http://natko.com/wordpress-ajax-login-without-a-plugin-the-right-way/ | |
| //html | |
| <form id="login" action="login" method="post"> | |
| <h1>Site Login</h1> | |
| <p class="status"></p> | |
| <label for="username">Username</label> | |
| <input id="username" type="text" name="username"> |
| <?PHP | |
| function getUserIP() | |
| { | |
| $client = @$_SERVER['HTTP_CLIENT_IP']; | |
| $forward = @$_SERVER['HTTP_X_FORWARDED_FOR']; | |
| $remote = $_SERVER['REMOTE_ADDR']; | |
| if(filter_var($client, FILTER_VALIDATE_IP)) | |
| { |
| <?php | |
| // Example 1 | |
| $show_after_p = 2; | |
| $content = apply_filters('the_content', $post->post_content); | |
| if(substr_count($content, '<p>') > $show_after_p) | |
| { | |
| $contents = explode("</p>", $content); | |
| $p_count = 1; | |
| foreach($contents as $content) | |
| { |
| ============================= | |
| **http://kickass.to/infiniteskills-learning-jquery-mobile-working-files-t7967156.html | |
| **http://kickass.to/lynda-bootstrap-3-advanced-web-development-2013-eng-t8167587.html | |
| **http://kickass.to/lynda-css-advanced-typographic-techniques-t7928210.html | |
| **http://kickass.to/lynda-html5-projects-interactive-charts-2013-eng-t8167670.html | |
| **http://kickass.to/vtc-html5-css3-responsive-web-design-course-t7922533.html | |
| *http://kickass.to/10gen-m101js-mongodb-for-node-js-developers-2013-eng-t8165205.html | |
| *http://kickass.to/cbt-nuggets-amazon-web-services-aws-foundations-t7839734.html |
| #!/bin/bash | |
| # Upload vps-setup.sh file | |
| # open terminal and change permission like: chmod +x ./setup.sh | |
| # ./vps-setup.sh | |
| # delete this file after setup :) | |
| COLOR_RESET="\033[33;0m" | |
| COLOR_RED="\033[33;31m" | |
| COLOR_GREEN="\033[33;32m" |
Update: please note that I have since switched to using a set of bash scripts instead of poluting the Git repository with git svn.
Author: Kaspars Dambis
kaspars.net / @konstruktors