开发者

include link list depending on category

I want to display the linklist widget only on a certain category.

The current way the sidebar is fetched is:

if (!function_exists('dynamic_sidebar') || !dynamic_sidebar(1))

Which doesnt give me a say in the calling of the links widget. If i put an if clause there, then the rest of the widgets dont get loaded.

开发者_如何学CSo i either need to customize the links widget it self or find a way to call the links widget directly?

And how do i check which category i'm on?


You can call an indivdual widget by using Conditional Tags « WordPress Codex, like this:

<?php if (in_category('1')) { ?>  call widget here
<?php } ?>

Or (haven't used this myself) load widgets by category, etc: WordPress › Dynamic Widgets « WordPress Plugins


To print the Category you are on use the_category(' '); Example :<p>Categories: <?php the_category(' '); ?></p> Also have a look at the Documentation http://codex.wordpress.org/Template_Tags/the_category

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜