Skip to content

Instantly share code, notes, and snippets.

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

Erick Kagai kagaim

🏠
Working from home
View GitHub Profile
@kagaim
kagaim / gist:1104849153258d37157b372eb913fd01
Created May 11, 2021 08:37
Using Shopify Storefront API to fetch recent posts, blog names and implement load more posts functionality
// Recent Posts
const container = document.querySelector('#blog-posts');
const load_more = document.querySelector('#load-more');
const spinner = document.querySelector("#spinner");
const cat_list = document.querySelector('#sidebar-cat-list');
const rp_title = document.querySelector('#sidebar-recent-posts');
function showSpinner() {
spinner.style.display = 'block';
}
@kagaim
kagaim / collection-sidebar.liquid
Created May 9, 2020 00:06 — forked from schaeken/collection-sidebar.liquid
Control the display order of tag groups lists in the collection sidebar using Supply's 'advanced tag filtering' - and control the sort order of the list items within that group using a link list.
<div class="grid-uniform">
{% assign group_array = settings.group_array | split: ',' %}
{% for group in group_array %}
{% if cat_array contains group %}
{% capture array %}{% unless array == blank or array == "" %}{{ array }},{% endunless %}{{group | strip}}{% endcapture%}
{% endif %}
{% endfor%}
{% assign cat_array = array | split:',' %}
{% comment %}
@kagaim
kagaim / pagination.php
Created August 22, 2017 19:36 — forked from cphilippsen/pagination.php
WordPress Pagination on single.php from the same category and/or taxonomy
<div id="pagination">
<?php
$prev_post = get_previous_post(true, '', 'taxonomy');
$next_post = get_next_post(true, '', 'taxonomy');
?>
<?php if (!empty( $prev_post )): ?>
<div class="prev">
<a href="<?php echo get_permalink( $prev_post->ID ); ?>">
Example codes for article Learning accessibility in WordPress themes, part I.
@kagaim
kagaim / examples.md
Created October 23, 2015 10:38 — forked from ErisDS/examples.md
Ghost Filter Query examples

Filter Queries - Example Use Cases

Here are a few example use cases, these use cases combine filter with other parameters to make useful API queries. The syntax for any of this may change between now, implementation, and release - they're meant as illustrative examples :)

Fetch 3 posts with tags which match 'photo' or 'video' and aren't the post with id 5.

api.posts.browse({filter: "tags:[photo, video] + id:-5", limit="3"});

GET /api/posts?filter=tags%3A%5Bphoto%2Cvideo%5D%2Bid%3A-5&limit=3