Skip to content

Instantly share code, notes, and snippets.

View mehrshaddarzi's full-sized avatar

Mehrshad Darzi mehrshaddarzi

View GitHub Profile
# -----------------------------------------------------------------
# .gitignore for WordPress @salcode
# ver 20160309
#
# From the root of your project run
# curl -O https://gist.githubusercontent.com/salcode/b515f520d3f8207ecd04/raw/.gitignore
# to download this file
#
# By default all files are ignored. You'll need to whitelist
# any mu-plugins, plugins, or themes you want to include in the repo.
<div style="text-align:center; font:50px Trebuchet Ms; color:#e3e3e3; margin-top:20%;">
Comming Soon ...
</div>
@mehrshaddarzi
mehrshaddarzi / Attr-product.php
Last active August 8, 2017 06:59
نمایش تمامی ویزگی های معرفی شده در ووکامرس
<?php
class Woocommerce_Bulk_Attribute_Manager_Product_Attibutes {
public function __construct() {
}
public function get_list_attributes(){
return wc_get_attribute_taxonomies();
}
public function get_list_attribute_slug(){
@mehrshaddarzi
mehrshaddarzi / add_product_in_wocom.php
Created August 8, 2017 14:00
افزودن محصول در ووکامرس
<?php
//add product dynamically
add_action('init',function(){
if(isset($_POST['pname-wordpress'])) {
//add post
$post_id = wp_insert_post( array(
'post_title' => trim($_POST['pname-wordpress']),
'post_content' => '',
'post_status' => 'draft',
@mehrshaddarzi
mehrshaddarzi / gist:61ba1265bdcc9e93b26808d25c15f8d6
Created August 9, 2017 05:38
add watchind node-sass in phpstorm
here is a simple configuration that works for me:
Program: <full path to your node-sass executable>, like ‘C:\Users\Elena.Pogorelova\AppData\Roaming\npm\node-sass.cmd’
Arguments: $FileName$ ../$FileNameWithoutExtension$.css
Working directory: $FileDir$
@mehrshaddarzi
mehrshaddarzi / bootstra-3-media-query.css
Created August 9, 2017 11:37
media query bootstrap 3
/* Large desktops and laptops */
@media (min-width: 1200px) {
}
/* Landscape tablets and medium desktops */
@media (min-width: 992px) and (max-width: 1199px) {
}
@mehrshaddarzi
mehrshaddarzi / GitHub-Forking.md
Created August 24, 2017 20:38 — forked from Chaser324/GitHub-Forking.md
GitHub Standard Fork & Pull Request Workflow

Whether you're trying to give back to the open source community or collaborating on your own projects, knowing how to properly fork and generate pull requests is essential. Unfortunately, it's quite easy to make mistakes or not know what you should do when you're initially learning the process. I know that I certainly had considerable initial trouble with it, and I found a lot of the information on GitHub and around the internet to be rather piecemeal and incomplete - part of the process described here, another there, common hangups in a different place, and so on.

In an attempt to coallate this information for myself and others, this short tutorial is what I've found to be fairly standard procedure for creating a fork, doing your work, issuing a pull request, and merging that pull request back into the original project.

Creating a Fork

Just head over to the GitHub page and click the "Fork" button. It's just that simple. Once you've done that, you can use your favorite git client to clone your repo or j

@mehrshaddarzi
mehrshaddarzi / gist:1ead62a22ec7a54aa6c2e19c3cd5398e
Last active August 24, 2017 21:21 — forked from CristinaSolana/gist:1885435
Keeping a fork up to date

1. Clone your fork:

git clone git@github.com:YOUR-USERNAME/YOUR-FORKED-REPO.git

2. Add remote from original repository in your forked repository:

cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream
@mehrshaddarzi
mehrshaddarzi / gist:b6adf5c8e772121cd6f258327816ae09
Created August 27, 2017 06:49 — forked from Kevinlearynet/gist:b4203d09e7a8d605725e
Faster admin-ajax.php for WordPress AJAX actions
<?php
define('DOING_AJAX', true);
if ( ! isset( $_POST['action'] ) )
die('-1');
require_once('../../../../wp-load.php');
// headers for JSON
header('Content-Type: application/json');
@mehrshaddarzi
mehrshaddarzi / gist:fb558aacf31435ee8de75ae142bba0ea
Created August 29, 2017 06:41 — forked from bueltge/gist:757903
This WordPress Plugin demonstrates how you can build your own plugin pages using the WordPress provided draggable metaboxes, requires WordPress 2.7 version, supports WordPress 2.8 changed boxing layout engine
<?php
/*
Plugin Name: HowTo Plugin
Plugin URI:
Description: This Plugin demonstrates how you can build your own plugin pages using the WordPress provided draggable metaboxes, requires WordPress 2.7 version, supports WordPress 2.8 changed boxing layout engine
Author: Heiko, Frank
Author URI: http://bueltge.de
Version: 0.1
License: