Skip to content

Instantly share code, notes, and snippets.

View dasbairagya's full-sized avatar
🎯
Focusing

Gopal Dasbariagya dasbairagya

🎯
Focusing
View GitHub Profile
@dasbairagya
dasbairagya / functions.md
Last active July 24, 2021 09:43
Change WordPress Login Logo

Change WordPress Login Logo

add_action( 'login_enqueue_scripts', array($this, 'theme_login_logo' ));
	public function theme_login_logo() 
	{ ?>
		<style type="text/css">
			#login h1 a, .login h1 a {
				background-image: url(<?php echo get_stylesheet_directory_uri(); ?>/assets/img/logo/site-login-logo.png);
			height:65px;
 width:320px;
@dasbairagya
dasbairagya / wp-config.md
Last active July 24, 2021 09:50
wp debug

Enable wordpress debug

wp-config.php

define('FS_METHOD','direct'); //install plugins without ftp
// Enable WP_DEBUG mode
define('WP_DEBUG', true);
if ( WP_DEBUG ) {
    @error_reporting( E_ALL );
    @ini_set( 'log_errors', true );
 @ini_set( 'log_errors_max_len', '0' );
@dasbairagya
dasbairagya / functions.md
Last active January 30, 2024 21:53
Get variation product data on selecting variation options - WooCommerce

Get variation product data on selecting variation options - WooCommerce

functions.php

add_action( 'woocommerce_before_single_variation',
 'action_wc_before_single_variation' );
function action_wc_before_single_variation() {
    ?>
    <script type="text/javascript">
    (function($){
        $('form.variations_form').on('show_variation', function(event, data){
@dasbairagya
dasbairagya / api.md
Last active July 24, 2021 09:57
Basic authentication system In wp rest api using Basic Auth plugins

Basic authentication system In wp rest api using Basic Auth plugins

plugins/api.php

<?php 
/*Template Name: Api*/

//Using Basic Authentication Plugins

$wp_request_url = 'http://localhost/notebook/wp-json/wp/v2/posts/';
Install xdebug for linux:
sudo apt-get install php-xdebug
sudo phpenmod xdebug
sudo gedit /etc/php/7.2/mods-available/xdebug.ini
then paste the below code:
zend_extension="xdebug.so"
xdebug.remote_enable = 1
xdebug.remote_port = 9000
xdebug.idekey = PHPSTORM
xdebug.show_error_trace = 1
@dasbairagya
dasbairagya / bash_aliases.txt
Last active January 28, 2020 17:49
Steps to create a permanent Bash alias:
Open the Terminal app
1.Edit ~/.bash_aliases or ~/.bashrc file using: sudo nano ~/.bash_aliases
2.Append your bash alias
For example append: alias update='sudo yum update'
3.Save and close the file.
4.Activate alias by typing: source ~/.bash_aliases
@dasbairagya
dasbairagya / twig-debug.odt
Last active March 26, 2020 15:12
Enable Twig Debug | Disable Cache | Drupal 8
👉️Initial steps to follow..
📌️1.Copy example.settings.local.php from /sites to /sites/default and rename to settings.local.php
📌️2.Enable render cache by uncomment this $settings['cache']['bins']['render'] = 'cache.backend.null'; in settings.local.php
📌️3.Go to sites/default/settings.php' and uncomment the commented lines that mention 'settings.local.php'.
📌️4.Go to /sites/development.services.yml file and paste below code at the top.
👉️development.services.yml
parameters:
http.response.debug_cacheability_headers: true
twig.config:
debug: true
@dasbairagya
dasbairagya / drupal-multiste.md
Last active July 24, 2021 10:03
🎗️ Drupal Multisite Setup🎗️

Drupal Multisite Setup

Hi we are creating drupal 8 multisite in our local machine.

👉️Initial steps to follow..

📌️Under /sites replicate the example.site.php and rename to sites.php

📌️Create an array in php named $sites.

'site1', 'webshop.local.site2'=&gt;'site2' ); ?&gt;
@dasbairagya
dasbairagya / host.md
Last active July 24, 2021 10:00
#Virtual Host setup in Apache | Linux

Virtual Host setup in Apache | Linux

📌️ sudo nano /etc/apache2/sites-available/platform.conf
 📌️ add the following code-
<VirtualHost *:80>
    ServerAdmin me@myserver
    DocumentRoot /var/www/html/your_folder_name/ingrammicrocloud/web
    ServerName platform.local
 ServerAlias *.platform.local
@dasbairagya
dasbairagya / index.odt
Last active August 21, 2019 08:42
#Generate SSH Key | Linux
👉️Create SSH key-------------
📌️ cd .ssh/
📌️ ssh-keygen
📌️ hit enter threesies
📌️ to copy the key run cat id_rsa.pub
📌️ add the ssh key to the server as public key