Skip to content

Instantly share code, notes, and snippets.

View ravismakwana's full-sized avatar
:octocat:

Ravi Makwana ravismakwana

:octocat:
  • India
View GitHub Profile
@mehedicsit
mehedicsit / select-text-woo-checkoutt.php
Created May 22, 2018 18:00 — forked from mchrislay/select-text-woo-checkoutt.php
Add Select Radio Buttons + Text Field option to WooCommerce Checkout Page
<?php
/**
* Outputs a rasio button form field
*/
function woocommerce_form_field_radio( $key, $args, $value = '' ) {
global $woocommerce;
$defaults = array(
'type' => 'radio',
'label' => '',
@alexander-young
alexander-young / .htaccess
Created August 17, 2018 16:44
WordPress - Increase maximum upload size
php_value upload_max_filesize 64M
php_value post_max_size 64M
php_value max_execution_time 300
php_value max_input_time 300
<?php
$product_id = 111;
wp_remove_object_terms( $product_id, 'simple', 'product_type' );
wp_set_object_terms( $product_id, 'variable', 'product_type', true );
// This injects a box into the page that moves with the mouse;
// Useful for debugging
async function installMouseHelper(page) {
await page.evaluateOnNewDocument(() => {
// Install mouse helper only for top-level frame.
if (window !== window.parent)
return;
window.addEventListener('DOMContentLoaded', () => {
const box = document.createElement('puppeteer-mouse-pointer');
const styleElement = document.createElement('style');
@craigedmonds
craigedmonds / allow-script-to-run.php
Created August 24, 2019 19:51
Allow a script to run only between two times and email on error
<?php
########################
// allow a script to only be run between two times
// EG: you can use this for a cron job and if someone tries to access it outside the times
// then you can block the request.
########################
header('Content-type: application/json; charset=utf-8'); //set the page to text only (optional)
$start_time = "09:00";
$end_time = "09:30";
$server_time_zone = date_default_timezone_get(); //this is the current server timezone
@alexander-young
alexander-young / functions.php
Created January 15, 2020 02:32
Defer Javascript in WordPress
function defer_parsing_of_js($url)
{
if (is_admin()) return $url; //don't break WP Admin
if (false === strpos($url, '.js')) return $url;
if (strpos($url, 'jquery.js')) return $url;
return str_replace(' src', ' defer src', $url);
}
add_filter('script_loader_tag', 'defer_parsing_of_js', 10);
@boospot
boospot / rooms.dat
Created March 10, 2020 11:02
metabox.io custom fields exported for rooms
a:1:{i:0;s:3388:"T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19:32
Creating a Custom Table with PHP in WordPress

Have you ever wondered what it takes to create a custom table in WordPress or why you would ever want or need to? WordPress comes with many different ways to store data out-of-the-box. Luckily for us, WordPress is flexible enough that we aren’t forced to shoehorn our every need into the ready-made solutions that come with it.

As a PHP application that depends on MySQL, we also have the option of creating our own tables in the database to meet our needs more precisely. Sometimes what might be a perfect solution for the MVP or 1.0 might not be the right choice as the software evolves.

In this article, we’ll walk through the process of creating a custom table, as well as an upgrade routine to boot.

Meet the Login Command

@alexander-young
alexander-young / functions.php
Created January 17, 2022 17:00
WP Basic Cleanup
<?php
// //remove emoji support
remove_action('wp_head', 'print_emoji_detection_script', 7);
remove_action('wp_print_styles', 'print_emoji_styles');
// // Remove rss feed links
remove_action( 'wp_head', 'feed_links_extra', 3 );
remove_action( 'wp_head', 'feed_links', 2 );
@teja156
teja156 / gist:8c35a05f43635da4cbd06b47c0d91e93
Last active July 16, 2026 04:30
Commands for deploying wordpress website on AWS EC2 shown in my YouTube video
YouTube video link: https://youtu.be/8Uofkq718n8
All the commands that are executed in the above youtube video are mentioned in this gist.
1. Install Apache server on Ubuntu
sudo apt install apache2
2. Install php runtime and php mysql connector
sudo apt install php libapache2-mod-php php-mysql
3. Install MySQL server