This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//$sql = "SELECT a.ID, a.post_date, a.post_title,a.post_content, a.post_name, b.meta_value,t.name as category_name , t.term_id,tax.taxonomy FROM wp_posts a inner JOIN wp_postmeta b inner JOIN wp_term_relationships rel ON rel.object_id = a.ID inner JOIN wp_term_taxonomy tax ON tax.term_taxonomy_id = rel.term_taxonomy_id inner JOIN wp_terms t ON t.term_id = tax.term_id WHERE a.post_status = 'publish' AND a.ID = b.post_id AND b.meta_key = '_thumbnail_id' AND tax.taxonomy = 'category' group by a.ID ORDER BY a.post_date DESC LIMIT 2;"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* if(isset($_POST['slug']) && !empty($_POST['slug'])){ | |
$oldslug = User::where('id',$_POST['user_id'])->value('slug'); | |
$newslug = str_slug($_POST['slug'], '-'); | |
//if data not change | |
if($oldslug == $newslug){ | |
$counts = User::where('slug',$newslug)->count(); | |
//if data more than the object original | |
if($counts>1){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
public static function leafNode() { | |
$allCats = Categories::all()->toArray(); | |
for ( $i = 0; $i < count($allCats); $i++) { | |
$children = DB::table('categoryOrganisations')->where('categoryId', $allCats[$i]['id'])->count(); | |
if($children === 0) { | |
DB::table('categories')->where('id', $allCats[$i]['id'])->update(['leaf' => 1]); | |
} else { | |
DB::table('categories')->where('id', $allCats[$i]['id'])->update(['leaf' => 0]); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function updateCurrencies() | |
{ | |
$listed = DB::table('currencies')->get(); | |
$ch = curl_init(); | |
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); | |
curl_setopt($ch, CURLOPT_URL, 'https://openexchangerates.org/api/latest.json?app_id=9dfc90f4fd60462d9088aa0039ccb30d&base=USD'); | |
$result = curl_exec($ch); | |
curl_close($ch); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if (!defined('ABSPATH')){ | |
define('ABSPATH', dirname(__FILE__) . '/'); | |
} | |
$main_domain = get_site_url(); | |
$port = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') || $_SERVER['SERVER_PORT'] == 443 ? 'https://' : 'http://'; | |
$main_domain = str_replace($port, '', $main_domain); | |
// var_dump($main_domain); | |
$viewed_domain = $_SERVER['HTTP_HOST']; |