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
//Get package | |
wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.4/wkhtmltox-0.12.4_linux-generic-amd64.tar.xz | |
sudo apt install wkhtmltopdf | |
//create symlink. | |
sudo ln -s /usr/bin/wkhtmltopdf /usr/local/bin/wkhtmltopdf | |
//At this point you can run this command to test that everything works. | |
/usr/local/bin/wkhtmltopdf google.com google.pdf |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> | |
<title>Industrial.</title> | |
<link href="css/invoice.css?v=1.0" rel="stylesheet"> |
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
(function($) { | |
$(".submit-contact-form").on("click", function(e) { | |
e.preventDefault(); | |
$.ajax({ | |
url: theme_data.site_url + 'wp-json/send-contact-form/v1/contact', | |
method: 'POST', | |
data: data | |
}).done(function(data){ |
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
//Removes all dots after the first one. | |
function removeExtraDots(str) { | |
return str.replace( /^([^.]*\.)(.*)$/, function ( a, b, c ) { | |
return b + c.replace( /\./g, '' ); | |
}); | |
} | |
function dotsCount(number) { | |
return (number.match(/[.]/g) || []).length; | |
} |
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 | |
use Illuminate\Pagination\Paginator; | |
//This example is a bit more comlex since I have columns that are foreign keys of the Ticket table. | |
public function index(Request $request) | |
{ | |
if($request->ajax()) { | |
$columns = ['tickets.id', 'client_name', 'location', 'priority_name', 'status_name', 'date']; | |
$draw = $request->draw; | |
$start = $request->start; //Start is the offset | |
$length = $request->length; //How many records to show |
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 | |
//One way | |
$this->validate($request, | |
[ | |
'data.*.name' => 'unique:priorities' | |
], | |
[ | |
'data.*.name.unique' => 'Priority name exists already, please pick a different name.' | |
] | |
); |
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 ath_register_event_taxonomies() | |
{ | |
$ath_taxonomy = new Ath_Taxonomy(); | |
$ath_taxonomy->create_hierarchical_taxonomy( "event", "event_category", "Event Categories", "Event Category", "event-category" ); | |
$ath_taxonomy->create_taxonomy( "event", "event_tag", "Event Tags", "Event Tag", "event-tag" ); | |
} | |
add_action( 'init', 'ath_register_event_taxonomies' ); |
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 | |
//Register login route | |
//Test in postman with - www.yourdomain.com/wp-json/login-user/v1/user | |
function uab_register_endpoints() | |
{ | |
register_rest_route('login-user/v1', '/user/', array( | |
'methods' => 'POST', | |
'callback' => 'uab_login_user' | |
)); |
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 this anywhere in the page. It assumes your content is inside an <article> tag. --> | |
<a class="floating-twitter-share-link" href="#" title="Share this" target="_blank"> | |
<i class="fa fa-twitter floating-twitter-share"></i> | |
</a> |
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 a_theme_auth_options_page() | |
{ | |
add_options_page( "A-Theme Auth options", "A-Theme Auth", "manage_options", "a-theme-auth", "a_theme_auth_options" ); | |
} | |
add_action( 'admin_menu', 'a_theme_auth_options_page' ); | |
function register_a_theme_auth_settings() | |
{ |