Skip to content

Instantly share code, notes, and snippets.

View thagxt's full-sized avatar
🎯
Focusing

ʞↃ∀ɾ thagxt

🎯
Focusing
View GitHub Profile
@thagxt
thagxt / Test your MySQL connection.php
Last active August 29, 2015 13:58
Test your MySQL connection
<?php
$link = mysql_connect('localhost', 'root', 'password');
if (!$link) {
die('Could not connect: ' . mysql_error());
}
echo 'Connected!';
mysql_close($link);
?>
@thagxt
thagxt / WP Get only URL to thumbnail image.php
Created April 3, 2014 14:24
WP Get only URL to thumbnail image
<?php // define ?>
<?php $thumb_id = get_post_thumbnail_id(); $thumb_url = wp_get_attachment_image_src($thumb_id,'steecky', true);?>
<?php // get ?>
<?php echo $thumb_url[0]; ?>
@thagxt
thagxt / Get Magento Latest Products everywhere!.php
Created April 3, 2014 14:29
Get Magento Latest Products everywhere!
<ul>
<?php
$store_id = Mage::app()->getStore()->getId();
$_productCollection = Mage::getResourceModel('reports/product_collection')
->addStoreFilter($store_id)
->addAttributeToFilter('visibility', 4)
->addAttributeToFilter('status', 1)
->addAttributeToSelect('*')
->setVisibility(array(2,3,4))
->setOrder('created_at', 'desc')
@thagxt
thagxt / change email address and name wordpress.php
Created April 20, 2014 18:29
Change default e-mail address and name on outgoing e-mails sent by WordPress.
<?php
// Change default e-mail address and name on outgoing e-mails sent by WordPress.
// code goes in your theme functions.php
// New Email
function sb_new_mail_from( $email ) {
$email = 'info@yoursite.com'; // change
return $email;
}
add_filter( 'wp_mail_from', 'sb_new_mail_from' );
@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 / 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 / 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 / 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) {