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
@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);
<?php
/*
* Roni Pinili
* 12/17/2017
* Laravel treebuilding (Parent - Child Collection)
Params child collection, parent collection
*/
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);
/*
* Load more post
*/
var ajaxurl = "<?php echo admin_url( 'admin-ajax.php' ); ?>";
var page = 2;
jQuery(function($) {
$('body').on('click', '.loadmore', function() {
var data = {
'action': 'load_posts_by_ajax',
'page': page,
@mixin w1580 {
@media only screen and (max-width: 1580px) {
@content;
}
}
@mixin w1480 {
@media only screen and (max-width: 1480px) {
@content;
}
@ronipl
ronipl / Shopify section - Gallery Carousel section.txt
Last active April 15, 2019 10:13
Shopify section - Gallery Carousel section *classes works on testament theme. just remove classes
@ronipl
ronipl / Shopify section - Text and image side by side
Last active April 15, 2019 10:13
Shopify section - Text and image side by side *classes works on testament theme. just remove classes
<section id="text-and-image-side-by-side-{{ section.id }}" class="text-and-image-side-by-side index-section" data-section-id="{{ section.id }}" data-section-type="image-section">
<div class="row">
<div class="desktop-6 tablet-2 mobile-2">
<h2>{{section.settings.heading}}</h2>
<div class="h2-border"></div>
<p>{{section.settings.content}}</p>
<div class="cta">
<a href="{{section.settings.button_url_link}}">{{section.settings.button_text}}</a>
</div>
</div>
@ronipl
ronipl / shopify-infinite-scroll-loadmore.js
Created May 30, 2019 13:46
Shopify infinite scroll load more
// Shortcircuit variable
let triggered = false;
function ScrollExecute() {
// Locate loadmore button
let moreButon = $('#more').last();
// Get URL from the loadmore button
let nextUrl = $(moreButon).find('a').attr("href");
console.log(nextUrl);
function loadmoreByButton(){
//var moreButon = $('#more').last();
var nextUrl = $('.more').attr("link");
$('body').on('click', '.more', function(){
$.ajax({
url: nextUrl,
<section class="home-our-products hop">
<div class="container-fluid">
<div class="row">
{% if section.settings.title != blank %}
<div class="section-header text-center">
<h2>{{ section.settings.title | escape }}</h2>
</div>
{% endif %}