Skip to content

Instantly share code, notes, and snippets.

View kimisgold's full-sized avatar

Kim Nguyen kimisgold

View GitHub Profile
@kimisgold
kimisgold / gist:2503606
Created April 26, 2012 22:14
tagged_users in wordpress
<?php
$tagged_once = get_users('meta_value=ngh-blog');
$tagged_both = get_users('meta_value=ngh-ndh');
$tagged_users = array_merge($tagged_once, $tagged_both);
foreach ($tagged_users as $user) {
$current_user = $user->ID;
if(get_user_meta($current_user,'first_name', true)) {
echo '<p>';
echo '<span class="member-name">' . get_user_meta($current_user,'first_name', true) . ' ' . get_user_meta($current_user,'last_name', true) . '</span>' ;
@kimisgold
kimisgold / gist:2783832
Created May 24, 2012 19:53
2.0 pagination
<?php if ($this->pageCount > 1): ?>
<?php $getParams = $_GET; ?>
<form action="" method="get" accept-charset="utf-8">
<ul class="pagination">
<?php if (isset($this->previous)): ?>
<!-- Previous page link -->
@kimisgold
kimisgold / gist:2876950
Created June 5, 2012 18:55
Searching for item types within a collection using MultiCollections plugin
<?php if($multiItems = multicollections_get_items_in_collection(10, 'Book')):
foreach($multiItems as $multiItem) {
if($fullsizeHtml = item_fullsize(array('class' => 'theme-book-cover', 'alt' => item('Dublin Core','Title')))) {
echo '<div class="theme-book">';
echo '<a href="'.item('permalink').'">'.$fullsizeHtml.'</a>';
echo '<p class="theme-book-meta three columns omega"><span class="theme-book-title">'.link_to_item().'</span><br><span class="theme-book-author">by '.item('Dublin Core','Creator').'</span></p>';
echo '</div>';
}
}
endif;
@kimisgold
kimisgold / bc_link_to_items_with_element_text.php
Created June 11, 2012 21:56
Custom link to items with element text helper
@kimisgold
kimisgold / gist:2913134
Created June 11, 2012 22:32
Example of creating a list of links using a Simple Vocab term
<li>Time Period
<?php
$db = get_db();
$timePeriodId = $db->getTable('Element')->findByElementSetNameAndElementName('Item Type Metadata', 'Time Period')->id;
$timePeriodTexts = explode("\n", $db->getTable('SimpleVocabTerm')->findByElementId($timePeriodId)->terms);
if($timePeriodTexts) {
echo '<ul class="sub-menu">';
foreach($timePeriodTexts as $timePeriodText) {
echo '<li>' . bc_link_to_items_with_element_text($timePeriodText, array(), 'browse', $timePeriodId, $timePeriodText) . '</li>';
}
@kimisgold
kimisgold / gist:2998458
Created June 26, 2012 19:53
JDH Table of Contents template
<?php
/*
Template Name: Archived Table of Contents
*/
?>
<?php get_header(); ?>
<div class="front-page twelve columns offset-by-two omega">
@kimisgold
kimisgold / gist:3137431
Created July 18, 2012 16:54
select dropdown
<style>
quick-filter-wrapper {
height: 25px;
background: #e2e2e2; /* Fallback */
background: url('../images/dropdown-arrow.png') no-repeat right center; /* Fallback */
background: url('../images/dropdown-arrow.png') no-repeat right center, linear-gradient(top, #f8f8f8, #e2e2e2);
background: url('../images/dropdown-arrow.png') no-repeat right center, -webkit-gradient(linear, left top, left bottom, from(#f8f8f8), to(#e2e2e2));
background: url('../images/dropdown-arrow.png') no-repeat right center, -webkit-linear-gradient(top, #f8f8f8, #e2e2e2);
background: url('../images/dropdown-arrow.png') no-repeat right center, -moz-linear-gradient(top, #f8f8f8, #e2e2e2);
@kimisgold
kimisgold / gist:3913019
Created October 18, 2012 16:30
advanced search markup
<form id="search-form" name="search-form" method="get" action="/~knguyen/omeka/admin/search">
<input type="text" name="query" id="query" value="">
<fieldset id="advanced-form">
<fieldset id="query-types">
<p>Search using this query type:</p>
<label><input type="radio" name="query_type" id="query_type-full_text" value="full_text" checked="checked">Full text</label><br>
<label><input type="radio" name="query_type" id="query_type-boolean" value="boolean">Boolean</label><br>
<label><input type="radio" name="query_type" id="query_type-exact_match" value="exact_match">Exact match</label>
</fieldset>
<fieldset id="record-types">
@kimisgold
kimisgold / gist:3913093
Created October 18, 2012 16:38
search form helper edits
<?php echo $view->form('search-form', $options['form_attributes']); ?>
<?php echo $view->formText('query', $_GET['query']); ?>
<?php if ($options['show_advanced']): ?>
<fieldset id="advanced-form">
<fieldset id="query-types">
<p><?php echo __('Search using this query type:'); ?></p>
<?php echo $view->formRadio('query_type', $_GET['query_type'], null, $validQueryTypes); ?>
</fieldset>
<?php if($validRecordTypes): ?>
<fieldset id="record-types">
@kimisgold
kimisgold / submenu-check.php
Created December 19, 2013 19:01
Check to see if Omeka main public nav has submenus.
<?php
$nav = new Omeka_Navigation;
$nav->loadAsOption(Omeka_Navigation::PUBLIC_NAVIGATION_MAIN_OPTION_NAME);
$nav->addPagesFromFilter(Omeka_Navigation::PUBLIC_NAVIGATION_MAIN_FILTER_NAME);
$view_nav = get_view()->navigation()->menu($nav)->getPages();
foreach($view_nav as $page) {
if($page->hasPages()) {
echo 'has submenus';
break;
}