Topic RSS
10:19 pm
22 January, 2011
OfflineHi,
I'd like to use the search filter in the sidebar.
Is it possible to use this in a Wordpress template?
sb_print_filters();
If so, what arguments would need to go in it?
Or, is there a way to use the [filters_form] shortcode in the sidebar?
If it's possible, is there an easy way to change the filter form layout / fields etc. ?
*FEATURE REQUEST*
Is this a possibility for future development?
To be able to search by Preacher, Series, and Book from a Widget would be awesome.
Thanks very much if you can help.
Hugh Bourne
bhmc.org.uk
Ps. old friends of Nat Ayling – small world!
12:49 am
22 January, 2011
OfflineOk…
Problem solved.
Hacked code from frontend.php that controls drop-down filter to perform same job in sidebar. It's hardcoded into the template file.
If anyone has the knowledge to do the same, but as a nice tidy widget that would be very nice.
Thanks.
3:40 am
13 July, 2009
OfflineThat looks fantastic.
2:42 pm
13 September, 2011
Offline6:11 am
1 November, 2010
Offline10:50 pm
22 January, 2011
OfflineHello folks.
Sorry for the delay, I was out of the country for a while after sorting this.
The process to create this involved creating a template page for the sermon page. I've included the code below for the sidebar element of the template, so take your standard page template and replace the sidebar section with this code – I also included a dynamic sidebar for the other widgets that aren't hardcoded into the template file.
I'm sure I did, but I can't remember any major changes made to the plugin files, essentially this code is just ripped from the frontend.php file.
Hope this is helpful. I don't check this often, you can try me at hughbo AT gmail.com for help, no promises.
Thanks
<div id="sermon-search" class="widget sidebar-block sermon-search"><h3 class="widgettitle">Search Sermons</h3>
<?php
// Drop-down filter
$preachers = $wpdb->get_results("SELECT p.*, count(p.id) AS count FROM {$wpdb->prefix}sb_preachers AS p JOIN {$wpdb->prefix}sb_sermons AS s ON p.id = s.preacher_id GROUP BY p.id ORDER BY count DESC, s.datetime DESC");
$series = $wpdb->get_results("SELECT ss.*, count(ss.id) AS count FROM {$wpdb->prefix}sb_series AS ss JOIN {$wpdb->prefix}sb_sermons AS sermons ON ss.id = sermons.series_id GROUP BY ss.id ORDER BY sermons.datetime DESC");
$services = $wpdb->get_results("SELECT s.*, count(s.id) AS count FROM {$wpdb->prefix}sb_services AS s JOIN {$wpdb->prefix}sb_sermons AS sermons ON s.id = sermons.service_id GROUP BY s.id ORDER BY count DESC");
$book_count = $wpdb->get_results("SELECT bs.book_name AS name, count(distinct bs.sermon_id) AS count FROM {$wpdb->prefix}sb_books_sermons AS bs JOIN {$wpdb->prefix}sb_books AS b ON bs.book_name = b.name GROUP BY b.id");
$sb = array(
'Title' => 'm.title',
'Preacher' => 'preacher',
'Date' => 'm.datetime',
'Passage' => 'b.id',
);
$di = array(
'Ascending' => 'asc',
'Descending' => 'desc',
);
$csb = isset($_REQUEST['sortby']) ? $_REQUEST['sortby'] : 'm.datetime';
$cd = isset($_REQUEST['dir']) ? $_REQUEST['dir'] : 'desc';
?>
<span class="inline_controls"><a href="#" id="show_hide_filter"></a></span>
<div id="mainfilter">
<form method="post" id="sermon-filter" action="<?php echo sb_display_url(); ?>">
<div style="clear:both">
<table class="sermon-search">
<tr>
<td class="fieldname"><?php _e('Preacher', $sermon_domain) ?></td>
<td class="field"><select name="preacher" id="preacher">
<option value="0" <?php echo (isset($_REQUEST['preacher']) && $_REQUEST['preacher'] != 0) ? '' : 'selected="selected"' ?>><?php _e('[All]', $sermon_domain) ?></option>
<?php foreach ($preachers as $preacher): ?>
<option value="<?php echo $preacher->id ?>" <?php echo isset($_REQUEST['preacher']) && $_REQUEST['preacher'] == $preacher->id ? 'selected="selected"' : '' ?>><?php echo stripslashes($preacher->name).' ('.$preacher->count.')' ?></option>
<?php endforeach ?>
</select>
</td>
</tr>
<tr>
<td class="fieldname"><?php _e('Book', $sermon_domain) ?></td>
<td class="field"><select name="book">
<option value=""><?php _e('[All]', $sermon_domain) ?></option>
<?php foreach ($book_count as $book): ?>
<option value="<?php echo $book->name ?>" <?php echo isset($_REQUEST['book']) && $_REQUEST['book'] == $book->name ? 'selected=selected' : '' ?>><?php echo stripslashes($book->name). ' ('.$book->count.')' ?></option>
<?php endforeach ?>
</select>
</td>
</tr>
<tr>
<td class="fieldname"><?php _e('Series', $sermon_domain) ?></td>
<td class="field"><select name="series" id="series">
<option value="0" <?php echo (isset($_REQUEST['series']) && $_REQUEST['series'] != 0) ? '' : 'selected="selected"' ?>><?php _e('[All]', $sermon_domain) ?></option>
<?php foreach ($series as $item): ?>
<option value="<?php echo $item->id ?>" <?php echo isset($_REQUEST['series']) && $_REQUEST['series'] == $item->id ? 'selected="selected"' : '' ?>><?php echo stripslashes($item->name).' ('.$item->count.')' ?></option>
<?php endforeach ?>
</select>
</td>
</tr>
<tr>
<td class="fieldname"><?php _e('Keywords', $sermon_domain) ?></td>
<td class="field" colspan="3"><input style="width: 50%" type="text" id="title" name="title" value="<?php echo isset($_REQUEST['title']) ? mysql_real_escape_string($_REQUEST['title']) : '' ?>" /></td>
</tr>
<tr>
<td colspan="1"></td>
<td class="field"><input type="submit" class="filter" value="<?php _e('Search', $sermon_domain) ?>"></td>
</tr>
</table>
<input type="hidden" name="page" value="1">
</div>
</form>
</div>
<script type="text/javascript">
jQuery.datePicker.setDateFormat('ymd','-');
jQuery('#date').datePicker({startDate:'01/01/1970'});
jQuery('#enddate').datePicker({startDate:'01/01/1970'});
<?php if ($hide_filter === TRUE) { ?>
jQuery(document).ready(function() {
<?php echo $js_hide; ?>
});
<?php } ?>
</script>
</div>
</div>
12:26 am
1 November, 2010
Offline1:50 pm
30 September, 2011
OfflineI hate to ask. But "creating a template page for the sermon page". Embarrassingly, I need more info. Does it belong in style.css or sidebar.php or something totally different. I use a custom theme for that page already.
Thanks in advance.
12:50 am
30 September, 2011
Offline3:29 am
1 November, 2010
Offline6:40 am
30 September, 2011
Offline12:53 pm
1 November, 2010
Offline1:07 pm
30 September, 2011
OfflineThanks for the response. I just figured it out 10seconds ago.
Doh! Totally my fault. A few days back i tryed to get a bit fancy with my css and ended up with an invisible floating object. So embarrasing. the link is http://www.cocwarragul.com.au . Our sermons are already available through itunes store or by RSS but the site is in maintance mode while I'm working on it. Do these little upgrades always end up taking 3 times longer then you think. Or is it just cause i'm new at it. Please tell me it gets easier.
Most Users Ever Online: 40
Currently Online:
18 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
malpan: 2453
jogen: 2440
VanWatterson: 652
GeraldSebring: 364
LucasWoltman: 362
RandellFeenstra: 362
Member Stats:
Guest Posters: 7
Members: 2066
Moderators: 1
Admins: 1
Forum Stats:
Groups: 1
Forums: 2
Topics: 1071
Posts: 4045
Newest Members: Nixon Designs, zolaperry, tanec69, lbakyl, richdorm, Aaron Velasquez
Moderators: Ben Miller (387)
Administrators: Mark Barnes (425)
Log In
Register
Home





