Skip to content

Instantly share code, notes, and snippets.

@sirBlond
sirBlond / Drupal 7 views fields sorting
Created October 22, 2012 23:58
Drupal 7 simple views sorting realization via JavaScript
<script type="text/javascript">
function goURL(){
var url = document.getElementById("selectID").options[document.getElementById("selectID").selectedIndex].getAttribute("value");
window.location = url;
}
</script>
Sort by&nbsp;
<select id="selectID" onchange="javascript:goURL();">
<option value="?sort_by=title&sort_order=ASC">By title(ASC)</option>
<option value="?sort_by=created&sort_order=ASC">By creation date(ASC)</option>
@sirBlond
sirBlond / term_list.php
Created September 5, 2016 18:23
get terms list
function naked_print_tax_summary($tax = 'category') {
$tax_summary = naked_get_tax_summary($tax);
if(!empty($tax_summary)) {
ob_start(); ?>
<ul>
<?php foreach($tax_summary as $tax_item): ?>
<li>
<a href="<?= $tax_item['link']; ?>"><?= $tax_item['name']; ?></a>
<span class="posts-count"><?= $tax_item['count']; ?></span>
<?php if(isset($tax_item['childs']) && !empty($tax_item['childs'])): ?>