Skip to content

Instantly share code, notes, and snippets.

View EmranAhmed's full-sized avatar
🏠
Working from home

Emran Ahmed EmranAhmed

🏠
Working from home
View GitHub Profile
@EmranAhmed
EmranAhmed / functions.php
Last active June 8, 2023 20:34
Hook Info. Get Action hook info. What functions are hooked to an action / filter in WordPress? How can I see all the actions attached to an "add_action" hook?
<?php
if ( ! function_exists( 'hippo_plugin_hook_info' ) ):
function hippo_plugin_hook_info( $hook_name ) {
global $wp_filter;
$docs = array();
$template = "\t - %s Priority - %s.\n\tin file %s #%s\n\n";
echo '<pre>';
@EmranAhmed
EmranAhmed / array.php
Last active March 8, 2017 17:04 — forked from igorbenic/array.php
How to use the Starter Content in your WordPress Theme WP Starter Content, Demo contents
<?php
add_theme_support( 'starter-content', array(
// Content Section for Widgets
'widgets' => array(
// Sidebar
'sidebar-1' => array(
// Widget ID
'my_text' => array(
// Widget $id -> set when creating a Widget Class
<form class="reduce-form">
  <fieldset>
    <input type="text" name="firstname" placeholder="Enter first name" /><br/>
    <input type="text" name="lastname" placeholder="Enter last name"><br/>
    <input type="email" name="email" placeholder="Enter e-mail" /><br/>
    <button type="submit">Submit</button>
  </fieldset>
</form>
@EmranAhmed
EmranAhmed / using-twitter-bootstrsp.php
Last active January 24, 2017 11:38
UPB Using Twitter Bootstrap
<?php
if ( ! function_exists( 'your_theme_prefix_upb_grid_system' ) ){
function your_theme_prefix_upb_grid_system( $grid ) {
$grid[ 'name' ] = esc_html__( 'Starter Grid', 'your_theme_textdomain' );
$grid[ 'allGridClass' ] = 'column';
$grid[ 'prefixClass' ] = 'col'; // twb col-md-6
$grid[ 'groupClass' ] = 'row'; // twb row
@EmranAhmed
EmranAhmed / cookies.js
Last active December 23, 2016 09:14 — forked from CrocoDillon/cookies.js
Export your awesome module using AMD, CommonJS, Node.js or just as global.
/*
* Inspiration (well… copy pasting more or less) from:
* https://github.com/ScottHamper/Cookies/blob/0.3.1/src/cookies.js#L127-L140
*
* Thanks Scott!
*/
(function (global) {
'use strict';
var MyModule = function () {
<?php
// this will enable button
if ( ! function_exists( 'fashionstore_wp_page_paging' ) ) :
function fashionstore_wp_page_paging( $mce_buttons ) {
if ( get_post_type() == 'post' or get_post_type() == 'page' ) {
$pos = array_search( 'wp_more', $mce_buttons, TRUE );
if ( $pos !== FALSE ) {
@EmranAhmed
EmranAhmed / Slimdown.md
Created May 12, 2016 09:36 — forked from jbroadway/Slimdown.md
Slimdown - A simple regex-based Markdown parser.

Slimdown

A very basic regex-based Markdown parser. Supports the following elements (and can be extended via Slimdown::add_rule()):

  • Headers
  • Links
  • Bold
  • Emphasis
  • Deletions
@EmranAhmed
EmranAhmed / nginxproxy.md
Created May 9, 2016 10:47 — forked from soheilhy/nginxproxy.md
How to proxy web apps using nginx?

Virtual Hosts on nginx (CSC309)

When hosting our web applications, we often have one public IP address (i.e., an IP address visible to the outside world) using which we want to host multiple web apps. For example, one may wants to host three different web apps respectively for example1.com, example2.com, and example1.com/images on the same machine using a single IP address.

How can we do that? Well, the good news is Internet browsers

@EmranAhmed
EmranAhmed / list-pages-based-on-page-template.php
Last active January 29, 2016 10:15
List pages by page template
<?php
$args = array(
'posts_per_page' => -1, // List All page
'post_type' => 'page',
'meta_query' => array(
array(
'key' => '_wp_page_template',
'value' => 'page-template.php', // Your page template name, If you have page template in a directory like: page-templates, then you should specify it like: page-template/page-template.php :)
'compare' => '='
@EmranAhmed
EmranAhmed / vps-setup.sh
Last active February 16, 2018 15:55
Simple and Straightforward VPS ( ubuntu and debian ) setup :)
#!/bin/bash
# Upload vps-setup.sh file
# open terminal and change permission like: chmod +x ./vps-setup.sh
# ./vps-setup.sh
# delete this file after setup :)
COLOR_RESET="\033[33;0m"
COLOR_RED="\033[33;31m"
COLOR_GREEN="\033[33;32m"