Skip to content

Instantly share code, notes, and snippets.

@vdite
vdite / stack_pngs.php
Last active August 29, 2015 14:01
This GDlib Trick let you stack different transparent png Images to one.
<?php
$image_arr=array('path1.png', 'path2.png', 'path3.png');
echo gd_gen_image($image_arr);
function gd_gen_image($arr){
$base = imagecreatetruecolor(913, 500);
$color = imagecolorallocatealpha($base, 0, 0, 0, 127);
imagefill($base, 0, 0, $color);
@vdite
vdite / header.php
Last active August 29, 2015 13:57
Manual Twitter Cards and OG Graph Integration in Wordpress Head.php
<?php if ( is_singular() || is_front_page() ) { ?>
<meta name="twitter:card" content="summary" />
<meta name="twitter:creator" content="@YOUR-TWITTER-NAME" />
<meta name="twitter:url" content="<?php the_permalink() ?>" />
<meta name="twitter:title" content="<?php do_action('wpseo_the_title') ?>" />
<meta name="twitter:description" content="<?php do_action('wpseo_the_desc') ?>" />
<meta property="og:title" content="<?php do_action('wpseo_the_title') ?>">
<meta property="og:type" content="article">
<meta property="og:url" content="<?php the_permalink() ?>">
@vdite
vdite / log_arrays_to_file.php
Last active December 23, 2015 20:09
This is how to var_dump to a file with php
<?php
/** Thanks to Pascal Landau
** https://plus.google.com/105523642741376989823/posts
**/
$handle = fopen("path/log.log","a");
fwrite($handle, var_export($array_or_object, true));
fclose($handle);
?>