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
| // ES5 | |
| var DJ = (function() { | |
| function MyConstructor(name) { | |
| this.name = name; | |
| } | |
| MyConstructor.prototype.speak = function speak() { | |
| console.log(this.name + ' is spinning some tunes.'); | |
| } | |
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
| // ES5 | |
| var first = 'Forrest'; | |
| var last = 'Brownlie'; | |
| console.log('My name is ' + first + ' ' + last + '.'); | |
| // My name is Forrest Brownlie | |
| // ES6 | |
| const firstName = 'Forrest'; | |
| const lastName = 'Brownlie'; | |
| console.log(`My name is ${firstName} ${lastName}`); |
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 | |
| /* | |
| Plugin Name: My Widget | |
| Plugin URI: http://mydomain.com | |
| Description: My first widget | |
| Author: Me | |
| Version: 1.0 | |
| Author URI: http://mydomain.com | |
| */ |
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 get_excerpt_by_id($post_id){ | |
| $the_post = get_post($post_id); //Gets post ID | |
| $the_excerpt = $the_post->post_content; //Gets post_content to be used as a basis for the excerpt | |
| $excerpt_length = 35; //Sets excerpt length by word count | |
| $the_excerpt = strip_tags(strip_shortcodes($the_excerpt)); //Strips tags and images | |
| $words = explode(' ', $the_excerpt, $excerpt_length + 1); | |
| if(count($words) > $excerpt_length) : | |
| array_pop($words); | |
| array_push($words, '…'); |
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 get_excerpt_by_id($post_id, $length) | |
| { | |
| $the_post = get_post($post_id); //Gets post ID | |
| $the_excerpt = $the_post->post_content; //Gets post_content to be used as a basis for the excerpt | |
| $excerpt_length = $length; //Sets excerpt length by word count | |
| $the_excerpt = strip_tags(strip_shortcodes($the_excerpt)); //Strips tags and images | |
| $words = explode(' ', $the_excerpt, $excerpt_length + 1); | |
| if(count($words) > $excerpt_length) : | |
| array_pop($words); |