Search Options
close
Search the following clips:
All Clips
Everyone's Clips
My Guides
Sign Up
Install
Learn More
Login
in_category
morgainelefaye
follow
0
4-29-2007 6:20 PM
356 views
tags:
wordpress
,
wp
,
reference
,
howto
,
mlf
Add a Comment
Login
to Comment. Not a member yet?
Sign up
Today's Top Clips
What Cats Do When Left Home Alone
Snow Animals
Japanese Rice Field Art
A Hostile Climate of Fear
pic of the day
50 Beautiful, Funny and Witty Photos
MAD AS HELL
The Plan
Hobbits Are a New Human Species, Study of Fossils Concludes
Oh No! Not again!
visit the
Top Clips page
View the Top Clips from
April 29, 2007
Embed This Clip In Your Site...
<div style="margin: 12px 0px; font-family: arial; color: #333333; background: #ffffff; border: solid 4px #e5e5e5; width: 100%; clear: left;"><div class="CM_CTB_Content_Wrap" style="margin: 0px; padding: 0px;background-color: #ffffff;"><div style="border-bottom: solid 1px #dcdcdc; white-space: nowrap; margin-bottom: 8px; background-color: #eeeeee ;background-image: url(http://clipmarks.com/images/source-bg.gif); background-repeat: repeat-x; height: 24px; line-height: 24px; vertical-align: middle; padding-bottom: 4px; color: #666666; font-size: 10px;" ><a href="http://clipmarks.com/clip-to-blog/" title="see clips that are hot right now"><img src="http://content.clipmarks.com/blog_embed/c133c45e-6e0e-4d21-b82a-b4f58e32002a/B5CF9491-9A99-4D73-9D2A-F4F3B1256C66/" alt="" width="19" height="19" border="0" style="vertical-align: middle; margin: 0px 4px; display: inline; border: none; float:none;" /></a>clipped from <a title="http://codex.wordpress.org/Template_Tags/in_category" href="http://codex.wordpress.org/Template_Tags/in_category" style="font-size: 11px;">codex.wordpress.org</a></div><blockquote style="text-align: left; padding: 0px 8px; margin: 4px 0px 8px 0px; background: transparent; border: none;" cite="http://codex.wordpress.org/Template_Tags/in_category">Returns true if the current post is in the specified <A title="Glossary" href="http://codex.wordpress.org/Glossary#Category">Category</A>. Normally this tag is used within <A title="The Loop" href="http://codex.wordpress.org/The_Loop">The Loop</A>, but the $post variable must be set when <A title="" href="#Use_OUTSIDE_The_Loop">using this tag outside of the loop</A>.</blockquote><div style="height: 2px; font-size: 2px; background: #dcdcdc; border-bottom: solid 1px #f5f5f5; margin: 2px 4px;"></div><blockquote style="text-align: left; padding: 0px 8px; margin: 4px 0px 8px 0px; background: transparent; border: none;" cite="http://codex.wordpress.org/Template_Tags/in_category"><P>Normally, this tag must be used inside <A title="The Loop" href="http://codex.wordpress.org/The_Loop">The Loop</A> because it depends on a WordPress PHP variable (<TT>$post</TT>) that is assigned a value only when The Loop runs. However, you can <I>manually</I> assign this variable and then use the tag just fine. </P></blockquote><div style="height: 2px; font-size: 2px; background: #dcdcdc; border-bottom: solid 1px #f5f5f5; margin: 2px 4px;"></div><blockquote style="text-align: left; padding: 0px 8px; margin: 4px 0px 8px 0px; background: transparent; border: none;" cite="http://codex.wordpress.org/Template_Tags/in_category"><P>For example, suppose you want a <TT>single.php</TT> <A title="Templates" href="http://codex.wordpress.org/Templates">Template File</A> in your <A title="Using Themes" href="http://codex.wordpress.org/Using_Themes">Theme</A> that will display a <I>completely different</I> page depending on what category the individual post is in. Calling <TT>in_category()</TT> from within The Loop may not be convenient for your Template. So use the following as your Theme's <TT>single.php</TT>. </P></blockquote><div style="height: 2px; font-size: 2px; background: #dcdcdc; border-bottom: solid 1px #f5f5f5; margin: 2px 4px;"></div><blockquote style="text-align: left; padding: 0px 8px; margin: 4px 0px 8px 0px; background: transparent; border: none;" cite="http://codex.wordpress.org/Template_Tags/in_category"><PRE><?php $post = $wp_query->post; if ( in_category('17') ) { include(TEMPLATEPATH . '/single2.php'); } else { include(TEMPLATEPATH . '/single1.php'); } ?></PRE></blockquote></div><div style="margin: 0px 6px 6px 4px;"><table style="font-size: 11px;border-spacing: 0px;padding: 0px;" cellpadding="0" cellspacing="0" width="100%"><tr><td style="background:transparent;border-width:0px;padding:0px;"> </td><td align="right" style="background:transparent;border-width:0px;padding:0px;width:107px" width="107"><a href="http://clipmarks.com/share/B5CF9491-9A99-4D73-9D2A-F4F3B1256C66/blog/" title="blog or email this clip"><img src="http://content9.clipmarks.com/images/c2b-foot.png" border="0" alt="blog it" width="107" height="17" style="border-width:0px;padding:0px;margin:0px;" /></a></td></tr></table></div></div>
New from the makers of Clipmarks:
Amplify.com - Don't just share the news...Amplify it!
Clipmarks
Home
New Clips
Top Clips
Dashboard
Popular Topics
News
Life
Science
Technology
Entertainment
Get Started
Sign Up
Install Clipping Tool
How Clipping Works
Clip-to-Blog™
ClipSearch
Tools and Resources
FAQ
ClipWeek
Top Clippers
Top Tags
Site Map
About Clipmarks
About Us
Contact
Copyright
Privacy
EULA
OK