Show Front Page Nodes Only
kingandy - April 15, 2008 - 10:21
| Project: | Taxonomy Ticker |
| Version: | 5.x-1.2 |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Jump to:
Description
While adapting the Taxonomy Ticker into one that displays nodes from selected content types instead of by category (which seems to be something that was planned for in this module but never got implemented?), it occurred to me to add an option to display only nodes that have been promoted to the front page. I think it would be a useful feature to offer in this module too.
It was pretty simple to achieve, I added the following block of code to the admin_settings form:
<?php
$attributes = array();
if (variable_get('taxonomy_ticker_promoted_only',0)) $attributes['checked'] = 'checked';
$form['taxonomy_ticker_promoted_only'] = array(
'#type' => 'checkbox',
'#title' => t('Front Page Items Only'),
'#description' => t('Check this box to use only items that have been Promoted to Front Page.'),
'#attributes' => $attributes,
);
?>And then this code ahead of the db_rewrite_sql call in the taxonomy_ticker_contents() function:
<?php
$promote = variable_get('content_ticker_promoted_only',0)? 'AND n.promote = 1': '';
?>Then it was a simple matter of dropping the $promote variable into the query, after one of the WHERE clauses.

#1
I don't think it would be a good thing to add this kind of feature directly in Taxonomy Ticker. http://drupal.org/project/views_ticker may be more adapted to your needs.
#2
Fair enough. Maybe it's just that I've been mostly using the ticker as a 'front page only' block, which makes a 'promoted to front page' tie-in seem more logical.
FWIW, the code above adds the 'promoted' limitation as a configurable checkbox-based option, deactivated by default, so adding it wouldn't affect the way the module works by default or impact on those who already have it installed.
Oh, also, the second chunk of code should say 'taxonomy_ticker_promoted_only' instead of 'content_ticker_promoted_only'...
#3
Automatically closed -- issue fixed for two weeks with no activity.