Skip to content

Instantly share code, notes, and snippets.

View hchouhan's full-sized avatar
💡
Thinking

Harish Chouhan hchouhan

💡
Thinking
View GitHub Profile
@hchouhan
hchouhan / mamp.md
Created October 26, 2015 21:25 — forked from jfloff/mamp.md
How to get MAMP to work with SSL ... Yes really.

First of all you need to be able to run MAMP in port 80. This is a "heat check" if you don't have any process jamming http ports. You can check it like this:

sudo lsof | grep LISTEN

If you do happen to have any process with something like this *:http (LISTEN), you are in trouble. Before with adventure check if it isn't MAMP itself (yeah, you should close that beforehand)

ps <pid of that process>

If you don't see MAMP, you are in good hands, I have just the thing for you:

@hchouhan
hchouhan / template-tag-sub-page.php
Created September 27, 2015 22:48
Display Sub page
/**
* Display Sub Pages
*/
if ( ! function_exists( 'dreamsmedia_display_subpages' ) ) :
function dreamsmedia_display_subpages() {
$post = get_post();
$output = '';
@hchouhan
hchouhan / Embed Widget
Created September 22, 2015 12:53
Embed Widget in WP for my Clients Plugin
<?php
/*
Plugin Name: Embed Widget by Themeist
Plugin URI: http://themeist.co
Description: A simple but powerful widget to Embed Videos.
Version: 1.0.1
Author: themeist, hchouhan
Author URI: http://themeist.co
*/
@hchouhan
hchouhan / gist:61d8e18d4d6bf2a99682
Created July 3, 2015 09:32
MC4WP Redirect Immediately
// set redirect delay to 0
add_filter( 'mc4wp_form_redirect_delay', '__return_zero' );
// done
<?php
/**
* Piggyback Yoast SEO OpenGraph output to add Pinterest
* Rich Pin OpenGraph data for WooCommerce products
*/
add_filter( 'wpseo_opengraph_type', function( $og_type ) {
if ( 'product' == get_post_type() ) {
$og_type = 'product';
}
// awesome semantic comment
function better_comment($comment, $args, $depth) {
$GLOBALS['comment'] = $comment;
extract($args, EXTR_SKIP);
if ( 'article' == $args['style'] ) {
$tag = 'article';
$add_below = 'comment';
} else {
<?php
add_shortcode( 'dot_recommended_posts', array( &$this, 'dot_recommended_top_posts' ) );
function dot_recommended_top_posts( $atts, $content = null )
{
// get our variable from $atts
$atts = shortcode_atts( array(
'container' => 'li',
'number' => '10',
@hchouhan
hchouhan / gist:4be601dcefe40d9bdbc9
Last active December 9, 2022 18:49
IRT Shortcode
add_shortcode( 'dot_recommended_posts', array( &$this, 'dot_recommended_top_posts' ) );
function dot_recommended_top_posts( $atts, $content = null )
{
// define attributes and their defaults
extract( shortcode_atts( array (
'container' => 'li',
'number' => '10',
'post_type' => 'post',
@hchouhan
hchouhan / example-contact-page-wordpress
Created July 15, 2014 07:12
Example: Contact Us Template Page for WordPress
<?php
/*
Template Name: Contact
*/
?>
<?php
//If the form is submitted
if(isset($_POST['submitted'])) {
@hchouhan
hchouhan / Redirect Users After Login In WordPress
Created April 8, 2014 12:12
Redirect Users After Login In WordPress
<?php
// http://www.paulund.co.uk/redirect-login-wordpress
function redirect_home( $redirect_to, $request, $user )
{
return home_url();
}
add_filter( 'login_redirect', 'redirect_home' );