Skip to content

Instantly share code, notes, and snippets.

View asifsaho's full-sized avatar
💙

Asif Nawaz asifsaho

💙
View GitHub Profile
@asifsaho
asifsaho / Facebook Share Image
Created July 10, 2015 11:44
Facebook show a random image in a share, it grabbed from the link automatically, to make the thumbnail specific you need those meta property
<meta property="og:title" content="Red Vector Design | Designing Experiences" />
<meta property="og:url" content="http://redvectordesign.com" />
<meta property="og:image" content="http://redvectordesign.com/demo/wp-content/uploads/2015/06/fb.jpg" />
@asifsaho
asifsaho / bootstrap-pagination.php
Last active August 29, 2015 14:24 — forked from ediamin/bootstrap-pagination.php
Bootstrap style pagination support for WordPress
/*
* custom pagination with bootstrap .pagination class
* source: http://www.ordinarycoder.com/paginate_links-class-ul-li-bootstrap/
*/
function bootstrap_pagination( $echo = true ) {
global $wp_query;
$big = 999999999; // need an unlikely integer
$pages = paginate_links( 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>
@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(
<?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 / 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
@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' ),
<?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 / 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.
*/
?>