This file contains 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
add_filter( 'send_email_change_email', '__return_false' ); |
This file contains 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
add_action('init', 'register_cpt', 1); // Set priority to avoid plugin conflicts | |
function register_cpt() { | |
$singular = "_cpt_name_"; | |
$plural = "_cpt_name_plural_"; | |
$labels = array( | |
'name' => _x($plural, 'post type general name'), | |
'singular_name' => _x($singular, 'post type singular name'), | |
'add_new' => _x('Add New', $singular), | |
'add_new_item' => __('Add New '.$singular), |
This file contains 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, |
This file contains 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 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 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 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 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 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 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' ); |
OlderNewer