Skip to content

Instantly share code, notes, and snippets.

View faiyazalam's full-sized avatar
💭
Coding...

Faiyaz Alam faiyazalam

💭
Coding...
View GitHub Profile
@faiyazalam
faiyazalam / instagram.php
Created January 3, 2017 17:46
Get recent images from Instagram using PHP & cURL
<?php
/**
* Supply a user id and an access token
* Jelled explains how to obtain a user id and access token in the link provided
* @link http://jelled.com/instagram/access-token
*/
$userid = "";
$accessToken = "";
// Get our data
function fetchData($url){
@faiyazalam
faiyazalam / 1.php
Created September 18, 2017 08:45 — forked from sudar/1.php
How To Properly Create Tables In WordPress Multisite Plugins. Explanation at http://sudarmuthu.com/blog/how-to-properly-create-tables-in-wordpress-multisite-plugins/
<?php
// Creating tables in Single site installations
function on_activate() {
create_table();
}
function create_table() {
global $wpdb;
$table_name = $wpdb->prefix . 'table_name';
@faiyazalam
faiyazalam / custom-woocommerce-status.php
Created September 21, 2017 17:51
This is a custom plugin for woocommerce. This will add some custom bulk action in order listing.
<?php
/**
* @package Faiyaz_Custom_WC_Status
* @version 1.6
*/
/*
Plugin Name: Custom WooCommerce Status
Description: This is a custom plugin for woocommerce. This will add some custom bulk action in order listing.
Author: Faiyaz Alam
Version: 1.0
@faiyazalam
faiyazalam / wpmu_migration_sql.txt
Last active December 4, 2017 07:03
How to update all the required tables while Migrating Wordpress Multisite - Single Network
//For Primary Blog
UPDATE `wp_options` SET `option_value`='http://www.test.com' WHERE `option_name`='siteurl';
UPDATE `wp_options` SET `option_value`='http://www.test.com' WHERE `option_name`='home';
//For Secondary Blog
UPDATE `wp_2_options` SET `option_value`='http://www.test.com/blog_2' WHERE `option_name`='siteurl';
UPDATE `wp_2_options` SET `option_value`='http://www.test.com/blog_2' WHERE `option_name`='home';
//Repeat the above codes for all the remaining blogs
<?php
/**
* Plugin Name: EDD Heartbeat API test plugin
* Description: Demonstrates how to use the Heartbeat API to update the payments count on the dashboard
*/
// Load the heartbeat JS
function edd_heartbeat_enqueue( $hook_suffix ) {
// Make sure the JS part of the Heartbeat API is loaded.
wp_enqueue_script( 'heartbeat' );
@faiyazalam
faiyazalam / wp-list-table-custom.php
Created April 3, 2018 12:58
WP_List_Table - Custom
<?php
/*
Plugin Name: WordPress - WP_List_Table - Custom
*/
add_action( 'admin_menu','register_my_custom_menu_page');
function register_my_custom_menu_page(){
global $new_menu_page;
// creating admin menu
@faiyazalam
faiyazalam / mo
Created May 15, 2018 10:11
How to modify post data in the request object - Symfony - PIMCORE ?
//In service file: /var/www/html/pimcore/src/AppBundle/Resources/config/services.yml
AppBundle\EventListener\TestListener:
tags:
- { name: kernel.event_listener, event: kernel.request }
//In listner file: /var/www/html/pf/src/AppBundle/EventListener/UserListener.php
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
class TestListener {
@faiyazalam
faiyazalam / raw-sql-query-pimcore-db
Created May 21, 2018 13:58
Raw sql query using Pimcore\Db class in PIMCORE 5
use Pimcore\Db;
$sql = "SELECT * from table_name where`id` = ?";
$stmt = Db::get()->prepare($sql);
$stmt->bindParam(1, 101, \PDO::PARAM_INT);
$stmt->execute();
$result = $stmt->fetchAll();
@faiyazalam
faiyazalam / sample-virtual-host-pimcore-5.txt
Created November 13, 2018 05:28
Sample virtual host for PimCore -5
<VirtualHost *:80>
ServerName pim553bundle.local
DocumentRoot /var/www/html/pimcore/web
<Directory /var/www/html/pimcore/web/>
Options FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
</VirtualHost>
@faiyazalam
faiyazalam / array-insert-after.php
Created December 29, 2018 04:43 — forked from wpscholar/array-insert-after.php
Insert a value or key/value pair after a specific key in an array. If key doesn't exist, value is appended to the end of the array.
<?php
/**
* Insert a value or key/value pair after a specific key in an array. If key doesn't exist, value is appended
* to the end of the array.
*
* @param array $array
* @param string $key
* @param array $new
*