This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var parser = document.createElement('a'); | |
| parser.href = "http://example.com:3000/pathname/?search=test#hash"; | |
| parser.protocol; // => "http:" | |
| parser.hostname; // => "example.com" | |
| parser.port; // => "3000" | |
| parser.pathname; // => "/pathname/" | |
| parser.search; // => "?search=test" | |
| parser.hash; // => "#hash" | |
| parser.host; // => "example.com:3000" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| shoot: function shoot() { | |
| //console.log("testing 1"); | |
| var video = document.getElementById('viewfinder'); | |
| var w = video.videoWidth; | |
| var h = video.videoHeight; | |
| var canvas = document.getElementById('capture'); | |
| canvas.width = w; | |
| canvas.height = h; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // Get the WP global paged - this tells you what page number you're on | |
| // (returns either 0 (I think) or page number) | |
| global $paged; | |
| // Check to see whether we've moved on to another page | |
| if( $paged < 2): | |
| // Set a counter | |
| $count = 0; | |
| endif; | |
| ?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| featureCarousel = function () { | |
| // Set up some variables | |
| var $carousel = $('ul.feature-carousel'), // The carousel UL | |
| $lis = $carousel.find("li"), // An object of the entire list | |
| list = $.makeArray($lis), // Array of the list items - might be useful, might not, who knows! | |
| itemCount = list.length, | |
| curPos = 0, | |
| maxPos = itemCount - 2, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function simple_copyright () { | |
| return "© " . get_bloginfo('name') ." ". date("Y"); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| slidingSections = function () { | |
| var $container = $(".sliding-content"); | |
| var $titles = $("h3", $container); | |
| $(".section", $container).slideUp(0).width(460).hide(); // CM: setting width here to stop the dreaded slidedown jump :) | |
| $titles.css("cursor", "pointer").append(' <span>(click to expand)</span>'); | |
| $container.on( "click", "h3", function () { | |
| $(".section").slideUp(); | |
| $titles.removeClass("active"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Put this at the top of your functions.php file | |
| // Force users to login... | |
| add_action( 'template_redirect', 'force_login' ); | |
| function force_login () { | |
| if ( ! is_user_logged_in() ): | |
| // Redirect to the login screen | |
| header( 'Location: /wp-login.php?redirect_to=/' ); | |
| die(); | |
| endif; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // Perform the get meta inside the condition of the if statement, | |
| // it will return true if there's a value, false if not, | |
| // and if true the $meta variable will be set to the meta value | |
| if( $meta = get_post_meta($post_id, 'meta_name', true) ): | |
| echo $meta; | |
| else: | |
| // Do something else | |
| endif; | |
| ?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // Define the arguements as you would for a WP_Query | |
| $args = "whatever"; | |
| // Run get_posts instead of WP_Query, does a similar thing but now $slide_posts | |
| // will contain the query results in an array... | |
| $slide_posts = get_posts($args); | |
| // FOR LOOP! | |
| // 3 arguments (counter), (the test to see how many loops to run - for as long as i < the count of the array) (increment counter) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /* | |
| Template Name: Homepage | |
| */ | |
| $blog = new WP_Query('category_name=articles&posts_per_page=1'); | |
| // $featured_products = new WP_Query('category_name=featured&posts_per_page=10'); | |
| // Change to: | |
| $featured_products = get_posts('category_name=featured&posts_per_page=10'); |
OlderNewer