Skip to content

Instantly share code, notes, and snippets.

☕️
on Coffee!

Abhishek Deshpande deshabhishek007

View GitHub Profile
@deshabhishek007
deshabhishek007 / remove-post-meta-orphans.php
Created Feb 8, 2019
Remove Orphan values from post-meta Table in WordPress
View remove-post-meta-orphans.php
<ol><?php
$link = mysqli_connect("localhost","Username","Password","DBNameHere");
$sql = "SELECT `meta_id`,`post_id`,`meta_key`,Length(`meta_value`) as meta_data, `post_title`, `post_type` FROM `wp_postmeta` LEFT JOIN `wp_posts` on `wp_postmeta`.`post_id` = `wp_posts`.`ID` ORDER BY `wp_posts`.`post_title` ASC ";
$result = mysqli_query($link, $sql);
while($data = mysqli_fetch_assoc($result)){
if($data['post_title'] == NULL && $data['post_type'] == NULL){
@deshabhishek007
deshabhishek007 / Gutenberg-support-in-functions.php
Created Nov 29, 2018
Code to insert in Themes Function.php
View Gutenberg-support-in-functions.php
/*
* Adding Align wide support for Gutenberg
*/
add_theme_support( 'align-wide' );
/*
* Adding Blocks Style for Gutenberg
*/
@deshabhishek007
deshabhishek007 / gutenberg-support.css
Created Nov 29, 2018
CSS for Gutenberg Support in themes
View gutenberg-support.css
.has-regular-font-size {
font-size: 16px;
}
@media only screen and (min-width: 768px) {
.alignfull {
margin-left: calc(50% - 50vw);
margin-right: calc(50% - 50vw);
width: auto;
@deshabhishek007
deshabhishek007 / gist:8067223cf64ccbc0bdef9bfdf25e222a
Created Oct 30, 2018
autostart php, Mariadb, nginx and dnsmasq
View gist:8067223cf64ccbc0bdef9bfdf25e222a
brew services start php
sudo brew services start dnsmasq
brew services start mariadb
brew services start nginx
View gist:fe244fac084f8898f39734ea3ff0f846
jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore ../../peenak android-release-unsigned.apk key0
~/Library/Android/sdk/build-tools/28.0.3/zipalign -v 4 android-release-unsigned.apk release.apk
View SublimeLinter-Settings-user.json
// SublimeLinter Settings - User
{
"paths": {
"linux": [],
"osx": ["~/.composer/vendor/squizlabs/php_codesniffer/scripts/",
"~/.composer/vendor/squizlabs/php_codesniffer/bin/",
"/usr/local/bin/"],
"windows": []
},
"linters":{
View .htaccess
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
@deshabhishek007
deshabhishek007 / Permission Reset
Created Sep 28, 2018
Reset File Permission of Linux Server Machine
View Permission Reset
find public_html -type d -perm 0777 -exec chmod 755 {} \;
find public_html -type f -perm 0666 -exec chmod 644 {} \;
View extracted-menu.tpl
<div id="menu_container"></div>
{literal}
<script>
var json_path = "https://DOMAIN.HERE/wp-json/wp-menu-extractor/v2/menus/IDHERE";
var json_menu, menu_items, menu_markup;
fetch(json_path)
.then(json_menu => json_menu.json())
.then(json_menu =>{
View extracted-menu.php
<?php
header('Access-Control-Allow-Origin: *');
$json_path = "http://YourDOMainname.HERE/wp-json/wp-menu-extractor/v2/menus/MENUID";
$json_menu = json_decode(file_get_contents($json_path));
$menu_items = $json_menu->items;
echo '<ul class="menu_ul">';
menu($menu_items);
echo '</ul>';
You can’t perform that action at this time.