Skip to content

Instantly share code, notes, and snippets.

View qutek's full-sized avatar
💻
Working from home

Lafif Astahdziq qutek

💻
Working from home
View GitHub Profile
@qutek
qutek / rh_get_widget_data_for.php
Last active August 29, 2015 14:07 — forked from kingkool68/rh-get-widget-data-for-all-sidebars.php
[Wordpress] Display raw widget data
function rh_get_widget_data_for($sidebar_name) {
global $wp_registered_sidebars, $wp_registered_widgets;
// Holds the final data to return
$output = array();
// Loop over all of the registered sidebars looking for the one with the same name as $sidebar_name
$sibebar_id = false;
foreach( $wp_registered_sidebars as $sidebar ) {
if( $sidebar['name'] == $sidebar_name ) {
@qutek
qutek / functions.php
Last active October 31, 2023 07:03
[Wordpress] [Multisite] Get featured image by blog id on wordpress multisite
/* Get featured image */
if( !function_exists( 'get_the_post_thumbnail_by_blog' ) ) {
function get_the_post_thumbnail_by_blog($blog_id=NULL,$post_id=NULL,$size='post-thumbnail',$attrs=NULL) {
global $current_blog;
$sameblog = false;
if( empty( $blog_id ) || $blog_id == $current_blog->ID ) {
$blog_id = $current_blog->ID;
$sameblog = true;
}
@qutek
qutek / functions.php
Created September 4, 2014 05:16
[Wordpress] [Multisite] Get latest post from wordpress multisite blog
/* Get Latest post from all blogs */
function recent_mu_posts( $howMany = 10 ) {
global $wpdb;
global $table_prefix;
// get an array of the table names that our posts will be in
// we do this by first getting all of our blog ids and then forming the name of the
// table and putting it into an array
$rows = $wpdb->get_results( "SELECT blog_id from $wpdb->blogs WHERE
public = '1' AND archived = '0' AND mature = '0' AND spam = '0' AND deleted = '0';" );
@qutek
qutek / email-confirmation.php
Created August 8, 2014 17:46 — forked from elclanrs/email-confirmation.php
[Wordpress] Custom email confirmation on registration
<?php
/**
* Plugin Name: Email Confirmation
* Description: Send an email to the user with confirmation code and store form data in database until user confirms.
* Author: Cedric Ruiz
*/
class EmailConfirmation
{
const PREFIX = 'email-confirmation-';
@qutek
qutek / woocommerce-ajax.php
Last active May 27, 2024 16:04
[Wordpress] [Woocommerce] WooCommerce Ajax Handlers
<?php
/**
* WooCommerce Ajax Handlers
*
* Handles AJAX requests via wp_ajax hook (both admin and front-end events)
*/
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
/** Frontend AJAX events **************************************************/
@qutek
qutek / snipet.php
Created June 18, 2014 07:10
Add Custom Media Upload Worpress
/*************************
* Enqueue Media Uploader
*************************/
function enqueue_admin_scripts() {
if(function_exists('wp_enqueue_media')) {
wp_enqueue_media();
}
else {
wp_enqueue_script('media-upload');
wp_enqueue_script('thickbox');
@qutek
qutek / clone-form.html
Created June 11, 2014 10:25
Jquery Clone Form
<form>
<div id="container">
<input type="text" value="" /><br />
<textarea></textarea><br />
<select>
<option value="1" selected="selected">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select><br/>
<select>
@qutek
qutek / command-tweak-ubuntu.md
Last active August 29, 2015 14:01
Tweak Ubuntu

#####Enter following command to disable auto open nautilus window after mount Terminal Command:

gsettings set org.gnome.desktop.media-handling automount-open false

#####Enter following command in terminal to disable overlay scrollbar Terminal Command:

gsettings set com.canonical.desktop.interface scrollbar-mode normal

@qutek
qutek / install-copy-sync-ubuntu
Created May 13, 2014 11:01
Install Copy Sync Ubuntu
wget https://copy.com/install/linux/Copy.tgz
tar -xvzf Copy.tgz
# optional clean-up
rm Copy.tgz
# If your Ubuntu is Ubuntu 64bits:
cd copy/x86_64
# If your Ubuntu is Ubuntu 32bits: