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 / 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": ""
@vanpariyar
vanpariyar / dynamic-select-gutenberg.md
Created January 6, 2022 12:23
create dynamic selecting block for the website of post or any taxonomy in the WordPress Gutenberg block editor

Selcte and set the data on the attributes on the gutenberg fetch posts

  • This can be used as the many application like select articles based in custom post, custom section etc.
const SectionSelector = ( { props } ) => {
    const { attributes:{ exclude_section, section, tag, author }, setAttributes } = props;
    const [ searchTerm, setSearchTerm ] = useState('');

    const options = useSelect( (select) => {
@vanpariyar
vanpariyar / how to add anyone at ssh server.md
Last active October 12, 2021 07:48
How to add some one to server ssh

To Add Someone's ssh-key on the dev server

$ ssh to your server
$ cd .ssh/
$ nano authorized_keys
@vanpariyar
vanpariyar / update-value-of-array-of-object.md
Last active October 5, 2021 19:42
Javascript : Update Values on the array of object
"stats": [
  { "id":"0", "count": "22", "text": "Years of experience" },
  { "id":"1", "count": "186", "text": "Projects delivered" },
  { "id":"2", "count": "200+", "text": "Satisfied clients" }
],
	<div className="inner-block" key={ key } data-id={ key }>
    <RichText
@vanpariyar
vanpariyar / create-user-in-wordpress-using-php.php
Created August 24, 2021 08:47
Create a user in the wordpress dashboard using the PHP in the wordpress.
<?php
/**
* Create a user in the wordpress dashboard using the PHP in the wordpress.
*/
add_action('init', 'create_user_account');
function create_user_account() {
$username = 'username123';
$email = 'demo@edfsdf.com';
$password = 'pasword123';
$user_id = username_exists( $username );
@vanpariyar
vanpariyar / widget from caching.md
Created April 29, 2021 06:21
caching the widget on the html file from the API and increase site speed

Caching widget in HTML file so we can direclty call from the wp-content folder

this will improve the speed of the site

we are storing the response in the Wp-content folder, there are also a cron job that reflect changes on the server

<?php

/**
 * Adds Widget_Top_Article_Poc_Portrait widget.
@vanpariyar
vanpariyar / functions.md
Created January 26, 2021 09:04
how to select all of the urls email encoded in wordpress rewrite api

Hook the function

$regexMatchParameter = '([^/]+)'; is very useful

/**
 * Add User key parameter to the Query
 *
 * @hooked 'init'
 */
function addUserOptLinksEndpoint()

Symptoms The following message is displayed when trying to push to a Bitbucket Server repository:

error: Issuer certificate is invalid. while accessing https://@<BITBUCKET_HOST>:8443/ABC/test.git/info/refs fatal: HTTP request failed You just added a self signed certificate to Bitbucket Server and now your users are getting errors:

fatal: unable to access 'https://@<bitbucket_server>://scm///': server certificate verification failed. CAfile: /etc/ssl/certs/ca-certificates.crt CRLfile: none Cause The Bitbucket Server certificate is not trusted by the git client.