Recent Topics

Link to categorie, outside categorielist

Started by on Mar 06, 2005 – Contents updated: Mar 06, 2005

Mar 06, 2005 17:26    

How do i link to a specific cat, say cat no. 46, with a link that is nog listed in the categorielist.

I want to explain to my visitors what the better parts of being a member are. Therefor i want a link to a post i wrote in categorie 46.
This categorie should be invisible in the categorielist, but there should be a link to it in the sidebar.

Anyone has a clue?

Mar 07, 2005 10:46

I figured out the link to a specific category.
http://www.hostname.com/blogs/index.php?cat=46
for example

But this category still shows up in the category list.
Isn't there anyway to hide it...

I have searched the enitre forum but couldn't find a solution that fits my problems!

Mar 07, 2005 12:15

I suggest to make a new blog for these kind of stuff.
and you don't include this blog in the bloglist

Mar 07, 2005 17:27

So i should create an entirely new blog with just one category (the one I want to hide in the other blog)?

And i just put the link to blog=...?category=... where I want it?

I have tried this before, but it still shows the category in the sidebar!
This is what I don't want!

Mar 08, 2005 04:34

Simple.

Well OKAY ... in theory.

I'm hiding a category on [url=http://randsco.com]my site[/url].

It's called "updated recently". Because the cats are listed alphabetically, it SHOULD show up at the end of the list, right under Technical-Website ... but it's *poof* gone.

Step one: Assign unique class names to each sidebar category link by editing your _categories.php file (which should be in your particular custom skins folder). Part of that file (same name) MAY be directly in the folder above. You can merge those two files into one and replace the one in your custom skins folder. (That way, these changes will only affect that skin only). Find the comment "callback to display sublist element" ... that's the section we'll change.

I don't know what skin you're using, but the section to change should/may look like this:

echo '<a href="'.url_add_param( get_bloginfo('blogurl'), 'cat='.$cat_ID ).'">'.format_to_output($cat['cat_name'], 'htmlbody').'</a> <span class="dimmed">('.$cat['cat_postcount'].')</span>';

change it to:

echo '<div class="c'.$cat_ID.'"><a href="'.url_add_param( get_bloginfo('blogurl'), 'cat='.$cat_ID ).'">'.format_to_output($cat['cat_name'], 'htmlbody').'</a> <span class="dimmed">('.$cat['cat_postcount'].')</span></div>';

(I had to cut-n-paste a bunch to get this, as mine looks a bit different, but this should do it. Basically, you wrap the link in a <div> that has the class name c-plus-categoryID - selectors can't start with a number.)

Step 2 - To HIDE it - in your css just put in

div.c46 {display:none;}

, which will make it disappear. (You may have to monkey with margins and stuff, but that selector is unique).

Keep in mind ... this only handles the sidebar ... you may still have the category sho up on the blog entry title (IF you put a 'this post contained in categories:' call).

I've got a solution for that too, if that's the case.

Step 3 - to ADD the link where you want it .. just look at the HTML page source ... get the link construction from there and MANUALLY place it on your sidebar where you want it. (EDIT .. I see you have that solution already! ;) )

Hope this helps. :D

Mar 08, 2005 07:20

Thanks mate!
I'll give it a go to see if this works...

will prob be a lot of work with css but what the heck if it works!

Mar 08, 2005 10:26

Ok I have managed to get the CSS thing to work.
As you can see here:
http://www.dhost.info/mzungu/blogs/index.php

The categorylist first still showed a little bullet to indicate there had to be an item. But by changing the code you've posted to

echo '<span class="c'.$cat_ID.'"><a href="'.url_add_param( get_bloginfo('blogurl'), 'cat='.$cat_ID ).'">'.format_to_output($cat['cat_name'], 'htmlbody').'</a></ul><ul></span>


It doesn't anymore!
The only problem with that code is it doesn't close the <ul> tag so the other menu names and items look a little out of place.

But on top of that, the post area is still showing posts from the category I want to hide.

I only want those posts to appear when people click on a link I have put in the sidebar named 'Voordelen voor leden'

Can anyone figure this out?


Form is loading...

Build your own site! – This forum is powered by b2evolution CMS, a complete engine for your website.