Categories
Categories
How would I go about making it so that when you click on a category link, it will display ONLY the "sticky" or first post of the sub-categories? Is that a possibility?
-
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Re: Categories
Hi!
That's not possible without writing a custom plugin. Links to categories always show all postings in a category.
Best regards,
Garvin
That's not possible without writing a custom plugin. Links to categories always show all postings in a category.
Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
-
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Hi!
I personally see no reason for a "sticky only" categories view, so I can't offer help in the plugin creation
You could create your own subcategory containing those entries instead?
Best regards,
Garvin
I personally see no reason for a "sticky only" categories view, so I can't offer help in the plugin creation
You could create your own subcategory containing those entries instead?
Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
-
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Hi!
Yeah, but why not create a subcategory "Top News"? There you'd see all the top News of other categories. You just need to assign those entries also to the "Top News" category (Additional or instead of making them sticky)
Regards,
Garvin
Yeah, but why not create a subcategory "Top News"? There you'd see all the top News of other categories. You just need to assign those entries also to the "Top News" category (Additional or instead of making them sticky)
Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
-
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Hi!
Ah, I didn't know you were mixing categories. Well...that's a logical problem. How would you tell the category-template which template to prefer in your case of multiple category associations?
Inside the serendipity_event_categorytemplates.php file you'll see this one here:
That code only returns the Category-ID for an entry, if the entry has exactly one category assigned.
You could edit that code to add different IF-Checks, like if you wanted to always give Category 12 precedence, if an entry has multiple categories:
HTH,
Garvin
Ah, I didn't know you were mixing categories. Well...that's a logical problem. How would you tell the category-template which template to prefer in your case of multiple category associations?
Inside the serendipity_event_categorytemplates.php file you'll see this one here:
Code: Select all
function getID() {
global $serendipity;
if ($serendipity['GET']['category'] && !isset($serendipity['GET']['id'])) {
return (int)$serendipity['GET']['category'];
}
if ($serendipity['GET']['id']) {
$entry = serendipity_fetchEntry('id', $serendipity['GET']['id']);
if (count($entry['categories']) == 1) {
return (int)$entry['categories'][0]['categoryid'];
}
}
return 'default';
}
You could edit that code to add different IF-Checks, like if you wanted to always give Category 12 precedence, if an entry has multiple categories:
Code: Select all
function getID() {
global $serendipity;
if ($serendipity['GET']['category'] && !isset($serendipity['GET']['id'])) {
return (int)$serendipity['GET']['category'];
}
if ($serendipity['GET']['id']) {
$entry = serendipity_fetchEntry('id', $serendipity['GET']['id']);
if (count($entry['categories']) == 1) {
return (int)$entry['categories'][0]['categoryid'];
} else {
foreach($entry['categories'] AS $idx => $cdata) {
if ($cdata['categoryid'] == 12) {
return 12;
}
}
}
}
return 'default';
}
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
I understand the concept, just not sure how to implement.
As it stands, there is a category called "Camps", which is the second category I will assign to the posts (as in your example you called "top news"). This category and the rest of the posts should have the same template, which is different from the home/main page.
I tried replacing your "12" for "hands" which is the template I need, but didn't seam to work...
As it stands, there is a category called "Camps", which is the second category I will assign to the posts (as in your example you called "top news"). This category and the rest of the posts should have the same template, which is different from the home/main page.
I tried replacing your "12" for "hands" which is the template I need, but didn't seam to work...
-
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Hi!
You'll need to replace "12" with the ID, not the name of a category! The ID of a category is usually contained in the URL to your category, like index.php?categories/12-hands. If you put your mouse over the category editing link of the backend, you should see the ID!
Regards,
Garvin
You'll need to replace "12" with the ID, not the name of a category! The ID of a category is usually contained in the URL to your category, like index.php?categories/12-hands. If you put your mouse over the category editing link of the backend, you should see the ID!
Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/