Skip to content

Instantly share code, notes, and snippets.

View Faisalawanisee's full-sized avatar
🎯
Focusing

Faisal Khalid Faisalawanisee

🎯
Focusing
View GitHub Profile
@Faisalawanisee
Faisalawanisee / wp pagenavi In list
Last active February 12, 2019 15:47
wp pagenavi In list
if(function_exists('wp_pagenavi')){
function custom_wp_pagenavi( $args = array() ) {
if ( !is_array( $args ) ) {
$argv = func_get_args();
$args = array();
foreach ( array( 'before', 'after', 'options' ) as $i => $key )
$args[ $key ] = isset( $argv[ $i ]) ? $argv[ $i ] : "";
}
@Faisalawanisee
Faisalawanisee / Custom Taxonomy in Wp Query
Last active August 29, 2015 14:17
Custom Taxonomy in Wp Query
<?php // Get all term ID's in a given Custom Taxonomy
$taxonomy = 'Custom Taxonomy';
$taxonomy_terms = get_terms( $taxonomy, array(
'hide_empty' => 0,
'fields' => 'ids'
) );
$args = array(
// Type Parameters
'post_type' => 'post',
// Taxonomy Parameters
$parse_uri = explode( 'wp-content', $_SERVER['SCRIPT_FILENAME'] );
require_once( $parse_uri[0] . 'wp-load.php' );
function the_post_thumbnail_caption() {
global $post;
$thumbnail_id = get_post_thumbnail_id($post->ID);
$thumbnail_image = get_posts(array('p' => $thumbnail_id, 'post_type' => 'attachment'));
if ($thumbnail_image && isset($thumbnail_image[0])) {
echo '<span>'.$thumbnail_image[0]->post_excerpt.'</span>';
}
}
@Faisalawanisee
Faisalawanisee / tweets_json.php
Last active August 29, 2015 14:26 — forked from planetoftheweb/tweets_json.php
This gist will let you retrieve a series of tweets using the twitter v1.1 API. There's a few steps you have to do before you use this. 1. First, you need to go to http://dev.twitter.com/apps and create a new application. 2. You'll also need to download this library. https://github.com/themattharris/tmhOAuth (You only need the tmhOAuth.php file) …
<?php
require 'tmhOAuth.php'; // Get it from: https://github.com/themattharris/tmhOAuth
// Use the data from http://dev.twitter.com/apps to fill out this info
// notice the slight name difference in the last two items)
$connection = new tmhOAuth(array(
'consumer_key' => '',
'consumer_secret' => '',
'user_token' => '', //access token
// Get The Page ID You Need
get_option( ‘woocommerce_shop_page_id’ );
get_option( ‘woocommerce_cart_page_id’ );
get_option( ‘woocommerce_checkout_page_id’ );
get_option( ‘woocommerce_pay_page_id’ );
get_option( ‘woocommerce_thanks_page_id’ );
get_option( ‘woocommerce_myaccount_page_id’ );
get_option( ‘woocommerce_edit_address_page_id’ );
get_option( ‘woocommerce_view_order_page_id’ );
get_option( ‘woocommerce_terms_page_id’ );
manage_{$post_type}_posts_columns
https://codex.wordpress.org/Plugin_API/Filter_Reference/manage_$post_type_posts_columns
manage_{$post_type}_posts_custom_column
https://codex.wordpress.org/Plugin_API/Action_Reference/manage_$post_type_posts_custom_column
add_filter( 'manage_book_posts_columns', 'set_custom_edit_book_columns' );
add_action( 'manage_book_posts_custom_column' , 'custom_book_column', 10, 2 );
function set_custom_edit_book_columns($columns) {
unset( $columns['author'] );
@Faisalawanisee
Faisalawanisee / open-graph-protocol-examples.html
Last active February 10, 2019 22:00
Open Graph Protocol Examples
<meta property="og:title" content="Full structured image property">
<meta property="og:site_name" content="Open Graph protocol examples">
<meta property="og:type" content="website">
<meta property="og:locale" content="en_US">
<link rel="canonical" href="http://examples.opengraphprotocol.us/image-url.html">
<meta property="og:url" content="http://examples.opengraphprotocol.us/image-url.html">
<meta property="og:image:url" content="http://examples.opengraphprotocol.us/media/images/50.png">
<meta property="og:image:secure_url" content="https://d72cgtgi6hvvl.cloudfront.net/media/images/50.png">
<meta property="og:image:width" content="50">
<meta property="og:image:height" content="50">
@Faisalawanisee
Faisalawanisee / Deregistering Custom Post Types.php
Last active February 10, 2019 21:56
Deregistering Custom Post Types
<?php
/**
* Deregister matching post types.
*/
function custom_unregister_theme_post_types() {
global $wp_post_types;
foreach( array( 'portfolio', 'gallery', 'team', 'testimonial', 'highlight' ) as $post_type ) {
if ( isset( $wp_post_types[ $post_type ] ) ) {
unset( $wp_post_types[ $post_type ] );
}
@Faisalawanisee
Faisalawanisee / README.md
Created September 22, 2015 18:29 — forked from hofmannsven/README.md
Notes on working with Laravel CLI