Skip to content

Instantly share code, notes, and snippets.

View ronipl's full-sized avatar
🏠
Working from home

roni ronipl

🏠
Working from home
View GitHub Profile
function get_the_first_image() {
$files = get_children('post_parent='.get_the_ID().'&post_type=attachment&post_mime_type=image');
if($files) :
$keys = array_reverse(array_keys($files));
$j=0;
$num = $keys[$j];
$image=wp_get_attachment_image($num, 'large', false);
$imagepieces = explode('"', $image);
$imagepath = $imagepieces[1];
$thumb=wp_get_attachment_thumb_url($num);
<?php
/*
* Roni Pinili
* 12/17/2017
* Laravel treebuilding (Parent - Child Collection)
Params child collection, parent collection
*/
@ronipl
ronipl / Js download file
Last active October 8, 2019 02:53
Download html images based on file source array.
var files = [
"file.ext",
]
var i;
var targets_count = files.length;
for (i = 0; i < targets_count; i++) {
files[i]
var partsArr = files[i].split('/');
console.log(partsArr);