Skip to content

Instantly share code, notes, and snippets.

View vanpariyar's full-sized avatar
🏠
Working from home

Ronak J Vanpariya vanpariyar

🏠
Working from home
View GitHub Profile
@vanpariyar
vanpariyar / setup environments.md
Last active April 18, 2022 09:04
Linux: WordPress development setup script

Apache2

sudo apt install apache2

PHP

sudo apt-get install libapache2-mod-php php php-common php-curl php-dev php-gd php-pear php-imagick php-mcrypt php-mysql php-ps php-xsl
@vanpariyar
vanpariyar / do not cache the specific page.md
Created April 8, 2022 09:58
do not cache specific page pressable batcache.

Exclude page by URL

if ( $batcache ) {
   /**
    * exclude URL from cache.
    */
    $exclude_cache = array('/some-page/','/other-page/');
    if(in_array($_SERVER['REQUEST_URI'], $exclude_cache )){
 $batcache->max_age = 0;
@vanpariyar
vanpariyar / redirect to blogger to WordPress.md
Last active October 21, 2022 09:36
How to redirect blogger to wordpress

Note: before doing this please import your blog to the wordpress 😄

  1. Switch the theme to classic
  2. select option for the backup and change
  3. change the code give below and pastes in the HTML editor
<html>
	<head>
		<title>Redirecting... BLOGNAME</title>
@vanpariyar
vanpariyar / appscript.md
Created March 22, 2022 09:04
Converting Google Sheets cell values to an object array with heading keys using Google Apps Script
  • Converting Google Sheets cell values to an object array with heading keys using Google Apps Script
  • Google sheet to json object
function myFunction() {
  const sheetName = "Sheet1";
  const [headers, ...rows] = SpreadsheetApp.getActiveSpreadsheet()
    .getSheetByName(sheetName)
    .getDataRange()
 .getValues();
@vanpariyar
vanpariyar / send-contact-data-to-contact-form.md
Created February 23, 2022 06:03
How to send static HTML form data to google sheets via Vanilla JavaScript

Basic HTML structure

<form action="{ADD APPSCRIPT URL}" method="post" role="form" class="php-email-form">
  <div class="row">
    <div class="col-md-6 form-group">
      <input type="text" name="name" class="form-control" id="name"
        placeholder="Your Name" required>
      <div class="validate"></div>
    </div>
### Here is the minimul server configuration for the virtual host for the bedrock.
```shell
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
<VirtualHost *:80>
ServerAdmin admin@aquapex.localhost
ServerName aquapex.localhost
ServerAlias www.aquapex.localhost
DocumentRoot /var/www/html/aquapex-wp/web
@vanpariyar
vanpariyar / fetch-production-image.md
Last active December 26, 2022 11:15
Use production image in local environment

How to use production image in the Local environment to fetch the path from the production

By doing This you can work on the local environment easily

const LOCAL_DOMAIN = "lcoalhost/project";
const LIVE_DOMAIN = "project_url";

// changes in the Url so we can store images in one place.
add_filter('wp_get_attachment_image_src', 'rewriteImgSrc', 10, 3);
@vanpariyar
vanpariyar / remove Divi shortcodes.md
Created January 18, 2022 14:32
Remove Divi shortcodes from the wordpress blogs and Content

This code can be use to Remove Divi shortcodes from the wordpress blogs and Content

put this code in the fucntions.php file

<?php
global $wpdb;
$allPosts = $wpdb->get_results("SELECT * FROM `wp_posts`");
foreach($allPosts as $post){
 $content = RemoveShortcodes('/\[\/?et_pb.*?\]/', '', $post-&gt;post_content);
@vanpariyar
vanpariyar / functions.php
Created January 18, 2022 10:50
Get random fun Facts on the WordPress
<?php
function realm_get_funfect(){
$array_of_element = array(
`It is impossible for most people to lick their own elbow. (try it!)`,
`A crocodile cannot stick its tongue out.`,
`A shrimp's heart is in its head.`,
`It is physically impossible for pigs to look up into the sky.`,
`The "sixth sick sheik's sixth sheep's sick" is believed to be the toughest tongue twister in the English language.`,
`If you sneeze too hard, you could fracture a rib.`,
`Wearing headphones for just an hour could increase the bacteria in your ear by 700 times.`,
@vanpariyar
vanpariyar / block.json
Last active January 21, 2022 12:00
Create sidebar for the custom tag and post type selection on WordPress editor formally Gutenberg with Dynamic block
{
"apiVersion": 2,
"name": "demo/content-with-sidebar",
"version": "0.1.0",
"title": "Content With Sidebar Block",
"category": "demo",
"attributes": {
"mediaURL": {
"type": "string",
"default": ""