Skip to content

Instantly share code, notes, and snippets.

View mohsinr's full-sized avatar

Mohsin Rasool mohsinr

View GitHub Profile
@mohsinr
mohsinr / style.css
Created July 31, 2019 08:21
keep bootstrap 3 panel collapsibles , expanded via CSS
#faqs-group .panel-collapse.collapse {display: block !important;}.faqs-section .panel-default>.panel-heading>a:after{display:none !important}
.faqs-section .panel-default>.panel-heading>a{
background-color: #0099a5!important;
margin-bottom: 0 !important;
border-radius: 4px 4px 0 0;
}
.faqs-section .panel-default{margin-bottom:20px !important;}
@mohsinr
mohsinr / gutenberg-tweaks.php
Created November 20, 2018 11:38
Disable Gutenberg Everywhere But Keep Enabled for Blog Posts ie (cpt Post)
<?php
//Disable Gutenberg for all but keep Enabled for Blog Posts only
function wm_gutenberg_disable_cpt($can_edit, $post_type){
if($post_type != 'post'){
$can_edit = false;
}
return $can_edit;
}
add_filter('gutenberg_can_edit_post_type', 'wm_gutenberg_disable_cpt', 10, 2);
@mohsinr
mohsinr / wp-one-time-functions.php
Created August 11, 2017 13:57
Assign tags to all posts in a custom post type, one time , quick and dirty code
<?php
# One time, assign missing tags
function assign_tag($id){
$row = unserialize(get_post_meta($id,'_nhome_meta',true));
$ownership = $row['OWNERSHIP'];
$tag = '';
@mohsinr
mohsinr / functions.php
Last active March 31, 2017 11:47
WordPress Move Meta data from OLD custom field Key to New key
<?php
# Inlcude in functions file for one time
# Remove after calling this function on some page one time
function warmarks_update_new_meta_from_old(){
# Provide your custom values here:
$post_type = 'pdf'; //change it with your post type
$old_metaKey = 'ecpt_pdflink';
$new_metaKey = '_jb_pdf';
@mohsinr
mohsinr / execute_on_router.sh
Created February 28, 2017 15:09 — forked from javikalsan/execute_on_router.sh
Simple Bash Script to execute a command on the router through telnet command
#!/bin/sh
# replace cmd1 for the command to execute
host=192.168.1.1
port=23
user=admin
pass=02B08
cmd1='adsl info'
current_date_time="`date +%Y-%m-%d\ %H:%M:%S`";
( echo open ${host}
@mohsinr
mohsinr / functions.php
Last active January 27, 2017 12:49
WordPress Taxonomies , Remove Trailing And Leading Spaces from Terms' Names
<?php
/**
Need to run this code just ONCE,
so remove it after one pageload once spaces are removed
**/
# List of Taxonomies with terms which have leading spaces
$taxos = array('rooms', 'settings', 'views', 'features');
@mohsinr
mohsinr / header.php
Created July 1, 2016 10:50 — forked from retlehs/header.php
Sage header template for Bootstrap top navbar component
<?php
// This file assumes that you have included the nav walker from https://github.com/twittem/wp-bootstrap-navwalker
// somewhere in your theme.
?>
<header class="banner navbar navbar-default navbar-static-top" role="banner">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only"><?= __('Toggle navigation', 'sage'); ?></span>
@mohsinr
mohsinr / 00.howto_install_phantomjs.md
Created April 12, 2016 19:24 — forked from julionc/00.howto_install_phantomjs.md
How to install PhantomJS on Debian/Ubuntu

How to install PhantomJS on Ubuntu

Version: 1.9.8

Platform: x86_64

First, install or update to the latest system software.

sudo apt-get update
sudo apt-get install build-essential chrpath libssl-dev libxft-dev
@mohsinr
mohsinr / functions-genesis.php
Created October 29, 2015 10:41
Genesis Framework WordPress custom tweaks
<?php
// Remove Genesis Default Stylesheet
remove_action( 'genesis_meta', 'genesis_load_stylesheet' );
//* Unregister layout settings
genesis_unregister_layout( 'content-sidebar-sidebar' );
genesis_unregister_layout( 'sidebar-content-sidebar' );
genesis_unregister_layout( 'sidebar-sidebar-content' );
//* Unregister secondary sidebar
@mohsinr
mohsinr / wp-functions.php
Last active December 19, 2018 12:34
WordPress Common Custom Codes for Functions.php
<?php
//* Add new image sizes
add_image_size( 'logo-thumb', 270, 180, TRUE );
//* Change the number of portfolio items to be displayed (props Bill Erickson)
add_action( 'pre_get_posts', 'minimum_portfolio_items' );
function minimum_portfolio_items( $query ) {
if ( $query->is_main_query() && !is_admin() && is_post_type_archive( 'portfolio' ) ) {
$query->set( 'posts_per_page', '6' );