Skip to content

Instantly share code, notes, and snippets.

View thagxt's full-sized avatar
🎯
Focusing

ʞↃ∀ɾ thagxt

🎯
Focusing
View GitHub Profile
@thagxt
thagxt / Magento do stuff depending on the frontend language.php
Created April 23, 2014 12:37
Magento do stuff depending on the frontend language
<?php
/*
+ If you need to include a file only for lets say, Italian stores, you can use the code below:
+ You can change it_IT with;
- de_DE // German
- fr_FR // French
- bg_BG // Bulgarian
- es_ES // Spanish
- en_US // USA English
@thagxt
thagxt / WordPress display all posts published this week.php
Created April 23, 2014 13:04
WordPress display all posts published this week
<?php // Displaying post from this week!
$week = date('W');
$year = date('Y');
$args=array(
'w'=> $week,
'year'=> $year,
'post_type' => 'post',
'post_status' => 'publish',
'posts_per_page' => -1,
'caller_get_posts'=> 1
@thagxt
thagxt / Get Permalink without domain.php
Created April 24, 2014 13:43
How to get WordPress Permalinks without the domain
@thagxt
thagxt / Do something between two dates with.php
Created April 27, 2014 13:36
Do something between two dates with php
<?php
$current_date = time();
$start_date = strtotime('2014-05-05 00:00:00'); // year-month-day hours:minutes:seconds
$end_date = strtotime('2014-05-06 00:00:00'); // year-month-day hours:minutes:seconds
if($current_date > $start_date && $current_date < $end_date){
// show the content you need in between these two dates
} else {
// show something else
}
@thagxt
thagxt / billing and shipping info in WooCommerce PDF Invoices & Packing Slips Invoice PDF separately.php
Last active March 4, 2019 23:36
Some times you feel the need to separate the billing info & shipping info you get in WooCommerce PDF Invoices & Packing Slips Invoice PDF file and get them one by one here's how to do it!
<?php
/*
* 1) open your invoice.php file
* 2) comment: // $wpo_wcpdf->billing_address();
* 3) copy/pasta: the first php block you see below
* 4) copy/pasta: the second php block remove what you don't need
* 5) save
* 6) go ham!
*/
?>
@thagxt
thagxt / ConvertWordPress-po-files-to-mo.markdown
Created April 28, 2014 14:14
Convert WordPress .po files to .mo

Convert .po to .mo

You can convert easily your .po (WordPress translation files) to .mo once

just go to > http://tools.konstruktors.com/

upload your .po file and download the converted .mo

@thagxt
thagxt / Add a custom url in the Wordprss Admin bar.php
Last active September 18, 2022 20:42
Add a custom url in the Wordprss Admin bar!
<?php // copy & paste the code below in your functions.php file, change the title and href and save it.
function add_link_to_adminbar($wp_admin_bar){
$args = array(
'id' => 'custom-link',
'title' => 'Custom Button Title',
'href' => 'http://example.org/',
'meta' => array(
'class' => 'custom-link-class'
@thagxt
thagxt / listFilesDirSpecParth.php
Created August 8, 2014 23:12
List All files of a Directory wiht specified path
<?php
// path to directory
$directory = "../images/harry/legs/";
// get all image files with a .jpg extension.
$images = glob($directory . "*.jpg");
// print each file name
foreach($images as $image) {
echo $image;
@thagxt
thagxt / pinter.js
Last active August 29, 2015 14:05
pinterest custom
! function(a, b, c) {
var d = a[c.k] = {
w: a,
d: b,
a: c,
s: {},
f: function() {
return {
callback: [],
get: function(a, b) {
@thagxt
thagxt / load-Jquery-if-not-yet-loaded.js
Created August 13, 2014 10:30
Load jQuery only if not already present inside page!!!
// loading jQuery only if not available
function theScript() {
// Do your stuff with jQuery
}
if(typeof jQuery=='undefined') {
var headTag = document.getElementsByTagName("head")[0];
var jqTag = document.createElement('script');