Skip to content

Instantly share code, notes, and snippets.

View codersaiful's full-sized avatar

Saiful Islam codersaiful

View GitHub Profile
@codersaiful
codersaiful / wp_ics.php
Created October 22, 2018 18:14 — forked from Jany-M/wp_ics.php
[WP] Generate a downloadable .ics file from any WordPress post or custom post type
<?php
// Add a custom endpoint "calendar"
function add_calendar_feed(){
add_feed('calendar', 'export_events');
// Only uncomment these 2 lines the first time you load this script, to update WP rewrite rules
/*global $wp_rewrite;
$wp_rewrite->flush_rules( false );*/
}
add_action('init', 'add_calendar_feed');
@codersaiful
codersaiful / ICS.php
Created October 22, 2018 18:13 — forked from jakebellacera/ICS.php
A convenient script to generate iCalendar (.ics) files on the fly in PHP.
<?php
/**
* ICS.php
* =======
* Use this class to create an .ics file.
*
* Usage
* -----
* Basic usage - generate ics file contents (see below for available properties):
<?php
//codersaiful new code START here
if(isset($data['fields']['field61921']) && !empty($data['fields']['field61921'])){
$data['fields']['field61921'] = get_the_title($data['fields']['field61921']);
}
if(isset($data['fields']['field61922']) && !empty($data['fields']['field61922'])){
$data['fields']['field61922'] = get_the_title($data['fields']['field61922']);
}
//codersaiful new code END here
# encoding: utf8 1,1 Top# encoding: utf8
import argparse
from datetime import datetime
import json
from random import randint
import requests
import sys
from time import sleep
<?php
$post_imit_each_column = 4;
/**
* To get all Categores as Array,
* Each array Item will be Object - Remember it
* Tuts for: https://www.facebook.com/groups/rrfoundation/permalink/1714332322007066/
* And: https://www.facebook.com/groups/UFTalent/permalink/401160307058625/
*
* @author Saiful Islam<[email protected]>
*/
<?php
//Copy this bellow line code and replace with indicated of screenshot. Screenshot: http://prntscr.com/jzefu7
$wpt_single_product_title .= get_the_title();
<?php
$cat_number = 2; //Sepcify your category ID here
$your_catname = get_cat_name( $cat_number );
//You can display your cat as your style
$args = array(
//All other here
'cat' => $cat_number,
@codersaiful
codersaiful / gist:3191b4bbe41e857bbba04e09e8433b16
Created June 3, 2018 05:46 — forked from jonathanmoore/gist:2640302
Get the share counts from various APIs

Share Counts

I have always struggled with getting all the various share buttons from Facebook, Twitter, Google Plus, Pinterest, etc to align correctly and to not look like a tacky explosion of buttons. Seeing a number of sites rolling their own share buttons with counts, for example The Next Web I decided to look into the various APIs on how to simply return the share count.

If you want to roll up all of these into a single jQuery plugin check out Sharrre

Many of these API calls and methods are undocumented, so anticipate that they will change in the future. Also, if you are planning on rolling these out across a site I would recommend creating a simple endpoint that periodically caches results from all of the APIs so that you are not overloading the services will requests.

Twitter

/*
* Only for Fronend Section
* @since 1.0.0
*/
(function($) {
$(document).ready(function() {
$('.wpt_product_table_wrapper .wpt_thumbnails img').click(function() {
/*
* Only for Fronend Section
* @since 1.0.0
*/
(function($) {
$(document).ready(function() {
$('body').on('click', '.wpt_product_table_wrapper .wpt_thumbnails img', function() {