Skip to content

Instantly share code, notes, and snippets.

Avatar
😊
Happy

Abhishek Ghosh AbhishekGhosh

😊
Happy
View GitHub Profile
@AbhishekGhosh
AbhishekGhosh / genesis_before_content_sidebar_wrap.php
Created Jun 23, 2020
Genesis custom homepage content via genesis_before_content_sidebar_wrap Hook
View genesis_before_content_sidebar_wrap.php
<?php if(is_front_page() && !is_paged()) : ?>
<div id="pagewrap-tcw">
<?php
$id = 5670;
$p = get_page($id);
echo apply_filters('the_content', $p->post_content);
?>
</div>
<?php endif; ?>
@AbhishekGhosh
AbhishekGhosh / 5670.php
Created Jun 23, 2020
WordPress show post content example with page ID 5670
View 5670.php
<?php
$id = 5670;
$p = get_page($id);
echo apply_filters('the_content', $p->post_content);
?>
@AbhishekGhosh
AbhishekGhosh / post-content.php
Created Jun 23, 2020
Show WordPress Post Content
View post-content.php
<?php
$id = ID#;
$p = get_page($id);
echo apply_filters('the_content', $p->post_content);
?>
@AbhishekGhosh
AbhishekGhosh / home_with_div.php
Created Jun 23, 2020
Genesis Home Page with div
View home_with_div.php
<?php if(is_front_page() && !is_paged()) : ?>
<div id="pagewrap-tcw"></div>
</div>
<?php endif; ?>
@AbhishekGhosh
AbhishekGhosh / homepage.php
Created Jun 23, 2020
Show Only on Genesis Home Page
View homepage.php
<?php if(is_front_page() && !is_paged()) : ?>
<?php endif; ?>
@AbhishekGhosh
AbhishekGhosh / External link icon Base64 Data URI
Created May 18, 2016
External link icon Base64 Data URI
View External link icon Base64 Data URI
@AbhishekGhosh
AbhishekGhosh / switch.ino
Created Feb 20, 2020
Samsung Smartwatch as Proximity Switch
View switch.ino
#include <BLEAdvertisedDevice.h>
#include <BLEDevice.h>
#include <BLEScan.h>
const int PIN = 2;
const int CUTOFF = -60;
void setup() {
pinMode(PIN, OUTPUT);
BLEDevice::init("");
@AbhishekGhosh
AbhishekGhosh / Convert Backticks to Code.php
Created Aug 20, 2014
Convert Backticks to Code Sparing Pre Block
View Convert Backticks to Code.php
function tcw_the_content( $content ) {
$content = preg_replace_callback('/<pre>(.*?)<\/pre>/s', function ($match) {
return '<pre>' . preg_replace('/`/', '\`', $match[1]) . '</pre>';
}, $content);
$content = preg_replace( '/`(.*?)`/', '<code>$1</code>', $content );
return $content;
}
add_filter( 'the_content', 'tcw_the_content' );
@AbhishekGhosh
AbhishekGhosh / backup.sh
Created May 15, 2017
mysql backup and upload to FTP
View backup.sh
#!/bin/bash
############### Infos - Edit them accordingly ########################
DATE=`date +%Y-%m-%d_%H%M`
LOCAL_BACKUP_DIR="/backups"
DB_NAME="database_name"
DB_USER="root"
DB_PASSWORD="root_password"
@AbhishekGhosh
AbhishekGhosh / Get Screenshot of Website.php
Created Sep 10, 2013
Get Screenshot of Website PHP Script
View Get Screenshot of Website.php
<?php
//**
//save this snippet as url_to_png.php
// usage: php url_to_png.php http://example.com
// Full credit to http://www.os-cms.net/blog/view/5/how-to-create-a-screen-dump-with-php-on-linux
// Modified by Robbie - http://www.category5.tv/
// Distributed by Dr. Abhishek Ghosh under GNU GPL 3.0
// Guessing that no one will come to bite !
// You can delete this comment part for personal usage.
You can’t perform that action at this time.