Skip to content

Instantly share code, notes, and snippets.

View Furqankhanzada's full-sized avatar
💻
Looking for new opportunities

Muhammad Furqan Furqankhanzada

💻
Looking for new opportunities
View GitHub Profile
@jaredkc
jaredkc / group-posts-by-terms.php
Last active April 25, 2024 03:39
Wordpress: get posts and group by taxonomy terms.
/**
* Get posts and group by taxonomy terms.
* @param string $posts Post type to get.
* @param string $terms Taxonomy to group by.
* @param integer $count How many post to show per taxonomy term.
*/
function list_posts_by_term( $posts, $terms, $count = -1 ) {
$tax_terms = get_terms( $terms, 'orderby=name');
$args = array(
@dhollenbeck
dhollenbeck / Menu_view.js
Created January 24, 2012 22:12
backbone.js collection with nested models for a nested list menu
App.views.Menu = App.views.View.extend({
//define this.el, the wrapper element
//id: '',
tagName: 'div',
className: 'menu',
id: 'menu',
//template function
template: _.template($('#menu-template').html()),