Skip to content

Instantly share code, notes, and snippets.

View AladinDridi's full-sized avatar
🎯
Focusing

Aladin Dridi AladinDridi

🎯
Focusing
  • Montréal
View GitHub Profile
add_action( 'woocommerce_thankyou', 'ad_redirectcustom');
function ad_redirectcustom( $order_id ){
$order = new WC_Order( $order_id );
$items = $order->get_items();
$product_id=223074;//id of your product
$product_id2=223076;// id of your product
$url ='';// url for the redirection after purchase your product
$url2='';
foreach ( $items as $item ) {
add_action( 'woocommerce_thankyou', 'bbloomer_redirectcustom');
function bbloomer_redirectcustom( $order_id ){
global $current_user;
$order = new WC_Order( $order_id );
$items = $order->get_items();
$product_id=223074;
$product_id2=223076;
foreach ( $items as $item ) {
add_action( 'woocommerce_thankyou', 'bbloomer_redirectcustom');
function bbloomer_redirectcustom( $order_id ){
global $current_user;
$order = new WC_Order( $order_id );
$url ='https://www.kademia.tn/parascolaire7eme.php';
$url2='https://www.kademia.tn';
if (($order->status!='failed')&&($order->payment_method =='other_payment')&&(( user_can( $current_user, "7eme")))) {
wp_redirect($url);
exit;
add_filter('woocommerce_available_payment_gateways','filter_gateways',1);
function filter_gateways($gateways){
global $woocommerce;
$inarray = false;
$specialItem = array(223074 );
foreach ($woocommerce->cart->cart_contents as $key => $values ) {//enumerate over all cart contents
if(in_array($values['product_id'],$specialItem)){//if special item is in it
$inarray = true;//set inarray to true
}
@AladinDridi
AladinDridi / svg
Last active August 28, 2017 23:29
scg balise
<svg id="mysvg" width="600" height="400" xmlns="http://www.w3.org/2000/svg" style="background-color:rgba(255,200,0,0.9);">
<rect id="myrect" width="300" height="100" x="10" y="10" fill="blue"/>
<rect id="myrect2" width="100" height="100" x="320" y="10" fill="green" style="stroke:red;stroke-width:5px;"/>
<circle id="mycircle" cx="150" cy="150" r="40" fill="red"/>
<circle id="mycircle" cx="320" cy="150" r="70" fill="pink" style="stroke:blue; stroke-width:5px;"/>
<line id="myline" x1="50" y1="350" x2="550" y2="30" style="stroke:black;stroke-width:10px;"/>
.wpglobus_flag{
clear:right;
}
html[lang="ar"] .wpglobus_flag{
margin-top:21px;
}
html[lang="fr-FR"] .left-menu-open .menu-panel ul li a span {
right: 0;
left: auto;
top: -10px;
@AladinDridi
AladinDridi / jsonarray
Created August 22, 2017 23:21
json array -rest api wordpress for android
package com.example.aladin_bureau.wordpress_wp;
import android.os.AsyncTask;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.ListView;
import com.squareup.okhttp.OkHttpClient;
import com.squareup.okhttp.Request;
import com.squareup.okhttp.Response;
<?php
//echo do_shortcode('[uo_courses enrolled_only="yes" price="no" limit="all" ]');
echo apply_filters( 'the_content',' [uo_courses enrolled_only="yes" price="no" limit="all" ] ');
?>
<?php
if(is_user_logged_in() && function_exists('pmpro_hasMembershipLevel') &&!pmpro_hasMembershipLevel() ){
echo apply_filters( 'the_content',' [uo_courses not_enrolled="yes" price="no" limit="all" ] ');
}
<?php
require_once("wp-load.php");
//or//
$incPath = str_replace(ABSPATH,"",getcwd());
include($incPath.'/wp-load.php');
$uploads_dir = wp_upload_dir();
//||(function_exists('pmpro_hasMembershipLevel'))&&(pmpro_hasMembershipLevel())// maybe i need this
//if(!is_user_logged_in()){
//exit;//
<html>
<head>
<meta charset="utf-8">
<Title>Les selecteurs en css3</Title>
<style type="text/css">
body{
background-color: aliceblue;
}
h3{
font-family: cursive;