composer create-project --prefer-dist laravel/laravel blog
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 | |
/** | |
* Custom rewrite rule for career page | |
*/ | |
add_action('init', function(){ | |
add_rewrite_tag('%office_location%','([^&]+)'); | |
add_rewrite_tag('%job_position%','([^&]+)'); | |
}); |
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 | |
// Show all php errors | |
ini_set('display_errors', 1); | |
ini_set('display_startup_errors', 1); | |
error_reporting(E_ALL); | |
// END |
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 | |
namespace App\Http\Controllers; | |
use Illuminate\Http\Request; | |
use Illuminate\Support\Facades\Storage; | |
class MediaController extends Controller | |
{ | |
/** |
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 | |
/** | |
* Create unique slug for post | |
*/ | |
public static function generateSlug($title) | |
{ | |
$slug = substr(str_slug($title), 0, 175); // Slug length will be 175 charecter | |
$latestSlug = static::whereRaw("slug = '$slug' or slug LIKE '$slug-%'")->value('slug'); | |
if(!empty($latestSlug)){ |
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 | |
/* | |
|--------------------------------------------------- | |
| PHP class to send HTTP request in better way | |
|--------------------------------------------------- | |
*/ | |
if(!class_exists('setHTTPRequest')){ | |
class setHTTPRequest | |
{ | |
/** |
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 | |
function affilate_list_pagination($total_items, $total_pages, $current){ | |
$output = '<span class="displaying-num">'.sprintf(_n('%s item', '%s items', $total_items), number_format_i18n($total_items)).'</span>'; | |
$removable_query_args = wp_removable_query_args(); | |
$current_url = set_url_scheme('http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']); |
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
var PrintContent = jQuery("div.col-sm-12 > div.inner"), | |
PrintContentClone = PrintContent.clone(); | |
$('<iframe>', { | |
name: 'myprintiframe', | |
class: 'productPrintFrame' | |
}) | |
.appendTo('body') | |
.contents().find('body') | |
.append(PrintContentClone); |
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
//Checked Check box | |
jQuery(':checkbox').prop("checked", true); | |
//Click all buttons at a time | |
jQuery('.row-options .delete-field').trigger("click"); |
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 | |
function wp_bootstrap_pagination(){ | |
$search_paging = get_the_posts_pagination(array( | |
'prev_text' => __( 'Previous', '' ), | |
'next_text' => __( 'Next', '' ), | |
'mid_size' => 2 | |
)); |