Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

Mahesh Waghmare maheshwaghmare

🎯
Focusing
Block or report user

Report or block maheshwaghmare

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@maheshwaghmare
maheshwaghmare / backward-compatibility.php
Created Dec 17, 2019
Astra Sites `wp-url` script dependency fix for old WordPress versions.
View backward-compatibility.php
<?php
/**
* Astra Sites `wp-url` script dependency fix for old WordPress versions.
*
* @todo Change the `prefix_` and with your own unique prefix.
*
* @since 1.0.0
*/
if( ! function_exists( 'prefix_backward_compatibility' ) ) :
function prefix_backward_compatibility() {
@maheshwaghmare
maheshwaghmare / remove-duplicate-ids.php
Created Dec 17, 2019
Astra Portfolio - Remove duplicate reference IDs from the website.
View remove-duplicate-ids.php
<?php
/**
* Remove Duplicate Reference ID's
*
* @todo Change the `prefix_` and with your own unique prefix.
*
* @since 1.0.0
*/
if( ! function_exists( 'prefix_remove_portfolio_duplicate_reference_ids' ) ) :
function prefix_remove_portfolio_duplicate_reference_ids() {
@maheshwaghmare
maheshwaghmare / disable-css-grid.php
Created Dec 12, 2019
Astra Portfolio - Disable the portfolio grid.
View disable-css-grid.php
<?php
if( ! function_exists( 'prefix_astra_portfolio_disable_grid_css' ) ) :
/**
* Disalbe the Portfolio Grid CSS
*
* @since x.x.x
* @return void
*/
function prefix_astra_portfolio_disable_grid_css() {
wp_deregister_style( 'astra-portfolio-grid' );
@maheshwaghmare
maheshwaghmare / rest-api-boilerplate.php
Created Dec 10, 2019
WordPress Rest API Boilerplate
View rest-api-boilerplate.php
<?php
/**
* Prefix Rest API
*
* @package Prefix Rest API
* @since 1.0.0
*/
if ( ! class_exists( 'Prefix_Rest_API' ) ) :
@maheshwaghmare
maheshwaghmare / plugin.php
Created Dec 8, 2019
Sample WordPress plugin init file.
View plugin.php
<?php
/**
* Plugin Name: PLUGIN NAME HERE
* Plugin URI: PLUGIN SITE HERE
* Description: PLUGIN DESCRIPTION HERE
* Author: YOUR NAME HERE
* Author URI: YOUR SITE HERE
* Text Domain: PLUGIN TEXT DOMAIN HERE
* Domain Path: /languages
* Version: 0.1.0
@maheshwaghmare
maheshwaghmare / wp-cli-hello-world.php
Last active Dec 6, 2019
Hello World program of WP CLI (WordPress Command Line Interface)
View wp-cli-hello-world.php
<?php
/**
* Common API's: WP CLI
*
* 1. Run `wp examples hello_world` Simple Command.
*
* @package wordpress-examples
* @since 1.0.0
*/
@maheshwaghmare
maheshwaghmare / plugin-performance-test.sh
Created Dec 6, 2019
Test website performance by deactivating the single plugin.
View plugin-performance-test.sh
for id in $(wp plugin list --fields=name --status=active --format=csv); do
echo $id;
wp plugin deactivate $id;
curl -s -o /dev/null -w "%{time_total}\n" http://localhost/dev.new/;
curl -s -o /dev/null -w "%{time_total}\n" http://localhost/dev.new/;
curl -s -o /dev/null -w "%{time_total}\n" http://localhost/dev.new/;
curl -s -o /dev/null -w "%{time_total}\n" http://localhost/dev.new/;
curl -s -o /dev/null -w "%{time_total}\n" http://localhost/dev.new/;
wp plugin activate $id;
done
@maheshwaghmare
maheshwaghmare / curl-website-speed-test-with-no-cache.sh
Last active Dec 6, 2019
Test the website speed with CURL request though command line.
View curl-website-speed-test-with-no-cache.sh
curl -s -o /dev/null -w "%{time_total}\n" -H "Pragma: no-cache" https://maheshwaghmare.com/
@maheshwaghmare
maheshwaghmare / highlight-post-date.php
Last active Dec 4, 2019
Highlight the dates column with readable date format. E.g. Format "Scheduled 2 weeks in advance" is more readable than "Scheduled 2019/12/18"
View highlight-post-date.php
<?php
/**
* Highlight the dates column with readable date format.
*
* @since 1.0.0
*
* @todo Change the `prefix_` and with your own unique prefix.
*
* @param string $t_time The published time.
* @param WP_Post $post Post object.
@maheshwaghmare
maheshwaghmare / highlight-post-date.php
Created Dec 4, 2019
Highlight the dates column with readable date format. E.g. Format Scheduled 2019/12/18
View highlight-post-date.php
<?php
/**
* Highlight the dates column with readable date format.
*
* @since 1.0.0
*
* @todo Change the `prefix_` and with your own unique prefix.
*
* @param string $t_time The published time.
* @param WP_Post $post Post object.
You can’t perform that action at this time.