Skip to content

Instantly share code, notes, and snippets.

View Matteo182's full-sized avatar

Matteo Ragusa Matteo182

View GitHub Profile
@Matteo182
Matteo182 / autologin.php
Created July 4, 2019 15:42
Funzione per l'autologin
/****************************************** */
// Funzione per l'autologin
/****************************************** */
function autologin($user_name){
$user = get_user_by('login', $user_name );
// Redirect URL //
if ( !is_wp_error( $user ) )
@Matteo182
Matteo182 / string_manipulation.php
Last active July 25, 2019 08:55
Funzione per manipolare le stringhe
/****************************************** */
// Funzione per manipolare le stringhe
/****************************************** */
function tdm_get_string_between($string, $start, $end){
$string = ' ' . $string;
$ini = strpos($string, $start);
if ($ini == 0) return '';
$ini += strlen($start);
$len = strpos($string, $end, $ini) - $ini;
@Matteo182
Matteo182 / call-api.php
Last active July 4, 2019 15:45
use curl for call API in php
/****************************************** */
// Funzione per richiamare le API
/****************************************** */
// Method: POST, PUT, GET etc
// Data: array("param" => "value") ==> index.php?param=value
function CallAPI($method, $url, $data = false){
$url_c = 'http://95.110.166.40/API/v1'.$url;
@Matteo182
Matteo182 / content.php
Created June 28, 2019 08:16
WordPress Loop in Made theme Google structured Data
<?php
/**
* Post rendering content according to caller of get_template_part.
*
* @package understrap
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
?>