Skip to content

Instantly share code, notes, and snippets.

View maheshwaghmare's full-sized avatar
🎯
Focusing

Mahesh Waghmare maheshwaghmare

🎯
Focusing
View GitHub Profile
@maheshwaghmare
maheshwaghmare / README.md
Created November 14, 2024 13:40
Gutenberg | Find blocks by block name - Recursively search for blocks by name within a nested block structure.
// Example usage.
import { parse } from '@wordpress/blocks'

const parsedContent = parse( content, {
	__unstableSkipMigrationLogs: true,
} )

const blocks = findNestedBlocksByName( parsedContent, 'core/paragraph' );
@maheshwaghmare
maheshwaghmare / hello-world.html
Last active May 3, 2023 19:54
The page generated with Auto-GPT-0.2.2. Read how to install, and use the AutoGPT in article https://maheshwaghmare.com/ai/autogpt/
<!DOCTYPE html>
<html>
<head>
<title>Hello World</title>
<style>
.card {
box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2);
transition: 0.3s;
width: 50%;
@maheshwaghmare
maheshwaghmare / index.php
Created April 25, 2023 07:37
Exclude post type from rank math analytics. Here we excluded the `plgnoptmzr_work` post type from the Rank Math analytics screens. Note: After adding the code just update any single excluded post type once so the Rank Math re-analyze and exclude the post type from the database.
<?php
if ( ! function_exists( 'prefix_rank_math_excluded_post_types' ) ) :
function prefix_rank_math_excluded_post_types( $post_types = [] ) {
// Add the post types which you want to exclude.
$excludes = [
'plgnoptmzr_work',
];
return array_diff_key( $post_types, array_flip( $excludes ) );
@maheshwaghmare
maheshwaghmare / gtag.php
Created January 20, 2023 12:34
Add/Modify Google tag manager variables for Rank Math SEO
<?php
if ( ! function_exists( 'prefix_analytics_gtag_config' ) ) :
/**
* Add/Modify Google tag manager variables
*
* @param array $args Google analytics arguments
*/
function prefix_analytics_gtag_config( $args = [] ) {
@maheshwaghmare
maheshwaghmare / increase-timeout.php
Created January 12, 2023 11:49
Increase the page speed request timeout from 30 seconds to 90 seconds.
<?php
add_filter( 'http_request_args', 'prefix_http_request_args', 10, 2 );
function prefix_http_request_args( $parsed_args, $url ) {
if ( false === strpos( $url, 'runPagespeed' ) ) {
return $parsed_args;
}
// Set timeout with 90 seconds.
$parsed_args['timeout'] = 90;
<?php
if ( ! function_exists( 'prefix_remove_spaces' ) ) :
/**
* Remove spaces
*
* @param array $args Arguments.
* @return array
*
* @see https://wp.me/P4Ams0-9Sn
@maheshwaghmare
maheshwaghmare / snippet.php
Created July 26, 2022 20:44
After Copy Redirect to Page (Copy Anything to Clipboard) - See https://wp.me/P4Ams0-aAq
<?php
if ( ! function_exists( 'prefix_copy_the_code_localize_vars' ) ) :
/**
* Localize vars.
*
* @return array
*/
function prefix_copy_the_code_localize_vars( $args = array() ) {
// Redirect to page url.
@maheshwaghmare
maheshwaghmare / mime.php
Last active October 11, 2021 09:51
Modify the MIME types of the Starter Templates
<?php
if ( ! function_exists( 'prefix_modify_mime_type' ) ) :
/**
* Modify the MIME types.
*
* @since x.x.x
*
* @param array $args File upload arguments.
* @return array.
@maheshwaghmare
maheshwaghmare / README.md
Created June 12, 2021 13:25
webpagetest.org API example

We can test our website speed on website https://webpagetest.org.

If you are developer and what to test your website though coding then checkout below Webpagetest API example.

We send the Webpagetest API rest request to test the site.

@maheshwaghmare
maheshwaghmare / change-text.php
Created May 19, 2021 05:54
WP Portfolio - Change load more button text
<?php
/**
* Change Button Text
*
* @todo Change the `prefix_` with your own unique string.
*
* @param string $button_text.
* @return string
*/
function prefix_change_load_more_text( $button_text = '' ) {