Skip to content

Instantly share code, notes, and snippets.

View rajucs's full-sized avatar
🎯
Focusing

Arman H rajucs

🎯
Focusing
View GitHub Profile
// Add Custom Product Note Field
add_action('woocommerce_single_product_summary', 'custom_product_note', 100);
function custom_product_note() {
echo '<br><div>';
woocommerce_form_field('customer_note', array(
'type' => 'textarea',
'class' => array('my-field-class form-row-wide'),
'label' => __('Product note'),
<script>
// Initialize the agent at application startup.
const fpPromise = import('https://openfpcdn.io/fingerprintjs/v4')
.then(FingerprintJS => FingerprintJS.load())
// Get the visitor identifier when you need it.
fpPromise
.then(fp => fp.get())
.then(result => {
// This is the visitor identifier:
// Perform your Ajax call here
$.ajax({
// ... your Ajax settings ...
success: function(response) {
// After the Ajax call is successful and content is loaded
// Scroll to the target div with animation
$("html, body").animate(
{
scrollTop: $("#wps-comment-list").offset().top - 50
},
window.onload = function () {
function getCookieValue(name) {
const cookies = document.cookie.split('; ');
for (const cookie of cookies) {
const [cookieName, cookieValue] = cookie.split('=');
if (cookieName === name) {
return cookieValue;
}
}
@rajucs
rajucs / gist:66faa6879bf1e2000985af2395c3daff
Created November 11, 2022 18:23
Add shortcode to wppb boilerplate
public function __construct()
{
$this->actions = array();
$this->filters = array();
$this->shortcodes = array();
}
/**
* Add a new shortcode to the collection to be registered with WordPress
<script>
jQuery(document).ready(function($) {
// Uploading files
var file_frame;
var wp_media_post_id = wp.media.model.settings.post.id; // Store the old id
var set_to_post_id = <?php echo $post->ID; ?>; // Set this
jQuery(document).on('click', '.bk-image-upload', function(event) {
event.preventDefault();
file_frame = '';
.bootstrapiso{/*!
* Bootstrap v4.4.1 (https://getbootstrap.com/)
* Copyright 2011-2019 The Bootstrap Authors
* Copyright 2011-2019 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
*/}.bootstrapiso :root{--blue:#007bff;--indigo:#6610f2;--purple:#6f42c1;--pink:#e83e8c;--red:#dc3545;--orange:#fd7e14;--yellow:#ffc107;--green:#28a745;--teal:#20c997;--cyan:#17a2b8;--white:#fff;--gray:#6c757d;--gray-dark:#343a40;--primary:#007bff;--secondary:#6c757d;--success:#28a745;--info:#17a2b8;--warning:#ffc107;--danger:#dc3545;--light:#f8f9fa;--dark:#343a40;--breakpoint-xs:0;--breakpoint-sm:576px;--breakpoint-md:768px;--breakpoint-lg:992px;--breakpoint-xl:1200px;--font-family-sans-serif:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";--font-family-monospace:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace}.bootstrapiso *,.bootstra
* To Seed Specific Seeder in Laravel
php artisan db:seed --class=PermissionsDemoSeeder