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
| //In your terminal, type: | |
| $ npm install express-handlebars —-save | |
| //--save adds Handlebars to the Express dependencies | |
| //Then open app.js and make sure the first few lines read as follows: | |
| ... | |
| var bodyParser = require('body-parser'); |
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
| //1. INSTALL EXPRESS GENERATOR | |
| //Needed to generate Express projects | |
| $ sudo npm install -g express-generator | |
| //2. CREATE THE EXPRESS FOLDER STRUCTURE | |
| $ express [project-name] |
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
| // how to write content to a file | |
| $content = 'File content ...'; | |
| Storage::put( 'myfile.txt', $content ); | |
| // how to read content from a file | |
| $content = Storage::get( 'myfile.txt' ); | |
| // how to delete a file | |
| Storage::delete( 'myfile.txt' ); |
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
| //Your original 2 WP_Query results: | |
| $query1 = new WP_Query($args_for_query1); | |
| $query2 = new WP_Query($args_for_query2); | |
| //Create a new WP_Query object to hold the joining of the 2 originals: | |
| $joined_query = new WP_Query(); | |
| $joined_query->posts = array_merge( $query1->posts, $query2->posts ); |
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 | |
| $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; | |
| $args = array( | |
| 'post_type' => 'product', | |
| 'posts_per_page' => POSTS_PER_PAGE, | |
| 'paged' => $paged, | |
| 'meta_query' => array( | |
| 'relation' => 'AND', | |
| 'price' => array( |
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 | |
| $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; | |
| $args = array( | |
| 'post_type' => 'games', | |
| 'author' => $user_id, | |
| 'meta_query' => array( | |
| 'relation' => 'AND', | |
| 'game_date' => array( | |
| 'key' => 'game_date', |
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
| Installing Intervention Image in Laravel 5 | |
| 1. Find the composer.json in your root directory and add "intervention/image": "2.*" in the require section: | |
| "require": { | |
| "php": ">=5.5.9", | |
| "laravel/framework": "5.2.*", | |
| "intervention/image": "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
| <?php | |
| if ( have_posts() ) : ?> | |
| <header class="page-header"> | |
| <?php | |
| the_archive_title( '<h1 class="page-title">', '</h1>' ); | |
| the_archive_description( '<div class="archive-description">', '</div>' ); | |
| ?> | |
| </header> |
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 | |
| global $wpdb; | |
| $limit = 0; | |
| $year_prev = null; | |
| $months = $wpdb->get_results("SELECT DISTINCT MONTH( post_date ) AS month , YEAR( post_date ) AS year, COUNT( id ) as post_count FROM $wpdb->posts WHERE post_status = 'publish' and post_date <= now( ) and post_type = 'post' GROUP BY month , year ORDER BY post_date DESC"); | |
| foreach($months as $month) : | |
| $year_current = $month->year; |
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
| <ul class='list-group'> | |
| <?php | |
| $args = array( | |
| 'type' => 'monthly', | |
| 'limit' => '', | |
| 'format' => 'custom', | |
| 'before' => '<li class="list-group-item">', | |
| 'after' => '</li>', | |
| 'show_post_count' => false, | |
| 'echo' => 1, |