Skip to content

Instantly share code, notes, and snippets.

View asifsaho's full-sized avatar
💙

Asif Nawaz asifsaho

💙
View GitHub Profile
@asifsaho
asifsaho / gist:10124200
Last active August 29, 2015 13:58
WP Plugin Comment
<?php
/**
* Plugin Name: Name Of The Plugin
* Plugin URI: http://URI_Of_Page_Describing_Plugin_and_Updates
* Description: A brief description of the Plugin.
* Version: The Plugin's Version Number, e.g.: 1.0
* Author: Name Of The Plugin Author
* Author URI: http://URI_Of_The_Plugin_Author
* License: A "Slug" license name e.g. GPL2
*/
@asifsaho
asifsaho / gist:d792e5c16010a62e583a
Last active August 29, 2015 14:04
WP Theme Comment
/*
Theme Name: Twenty Thirteen
Theme URI: http://wordpress.org/themes/twentythirteen
Author: the WordPress team
Author URI: http://wordpress.org/
Description: The 2013 theme for WordPress takes us back to the blog, featuring a full range of post formats, each displayed beautifully in their own unique way. Design details abound, starting with a vibrant color scheme and matching header images, beautiful typography and icons, and a flexible layout that looks great on any device, big or small.
Version: 1.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Tags: black, brown, orange, tan, white, yellow, light, one-column, two-columns, right-sidebar, flexible-width, custom-header, custom-menu, editor-style, featured-images, microformats, post-formats, rtl-language-support, sticky-post, translation-ready
@asifsaho
asifsaho / gist:a4726ef9ca4d68c4792e
Last active August 29, 2015 14:04
WP Page Template Comment
<?php
/*
* Template Name: My Custom Page
* Description: A Page Template with a darker design.
*/
?>
<?php
// the query
$the_query = new WP_Query( $args ); ?>
<?php if ( $the_query->have_posts() ) : ?>
<!-- pagination here -->
<!-- the loop -->
<?php while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
@asifsaho
asifsaho / functions
Created August 6, 2014 09:01
WP Custom Post
// Register Custom Post Type
function custom_post_type() {
$labels = array(
'name' => _x( 'Post Types', 'Post Type General Name', 'text_domain' ),
'singular_name' => _x( 'Post Type', 'Post Type Singular Name', 'text_domain' ),
'menu_name' => __( 'Post Type', 'text_domain' ),
'parent_item_colon' => __( 'Parent Item:', 'text_domain' ),
'all_items' => __( 'All Items', 'text_domain' ),
'view_item' => __( 'View Item', 'text_domain' ),
@asifsaho
asifsaho / gist:27442217c59997ba11af
Last active August 29, 2015 14:05
JQ Animate Scroll
// smothscroll
jQuery('.menu-item a[href^="#"]').on('click',function (e) {
e.preventDefault();
jQuery('html, body').stop().animate({
'scrollTop': jQuery(jQuery(this).attr('href')).offset().top
}, 500, 'swing', function () {});
});
// smothscroll
<?php
function init_url_rewrite_rule(){
add_rewrite_endpoint( 'edit',EP_PERMALINK | EP_PAGES | EP_ATTACHMENT );
if(get_option("EDIT_REWRITE_RULE")!=1){
flush_rewrite_rules();
update_option("EDIT_REWRITE_RULE",1);
}
}
function redirect_edit_url(){
@asifsaho
asifsaho / wp-query-ref.php
Last active August 29, 2015 14:10 — forked from luetkemj/wp-query-ref.php
WP_ Query Class Arguments List
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.com
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query#Parameters
* Source: https://core.trac.wordpress.org/browser/tags/3.9/src/wp-includes/query.php
*/
$args = array(
@asifsaho
asifsaho / .htaccess
Last active August 29, 2015 14:21 — forked from oritromax/.htaccess
<IfModule mod_setenvif.c>
<IfModule mod_headers.c>
<FilesMatch "\.(bmp|cur|gif|ico|jpe?g|png|svgz?|webp)$">
SetEnvIf Origin ":" IS_CORS
Header set Access-Control-Allow-Origin "*" env=IS_CORS
</FilesMatch>
</IfModule>
</IfModule>
<IfModule mod_headers.c>