Michael Fields
Forum Replies Created
-
Forum: Themes and Templates
In reply to: Conditional tags: need parent category to reach “children”This function maybe of help to you:
if( post_is_in_descendant_category( array( 55,25,16 ) ) ) { /* Do Stuff Here... */ } function post_is_in_descendant_category( $cats, $post_id = null ) { if( is_array( $cats ) ) { foreach ( ( array ) $cats as $cat ) { $descendants = get_term_children( ( int ) $cat, 'category' ); if ( $descendants && in_category( $descendants, $post_id ) ) return true; } } return false; }I’m not sure that I completely understand what you need to do, but this function accepts and array of category_id’s as it’s first argument and will return true if the current post is in any of these categories OR any of the categories’ descendants.
Hope this helps,
-MikeForum: Fixing WordPress
In reply to: Ability to comment on category pages?Have you checked out the P2 Theme? I know that it allows commenting on the “Blog Page” not sure how it works with category views though. In any case, I think that it would be a good theme to reference to learn how to add this functionality.
Forum: Fixing WordPress
In reply to: Can You Displaya post’s gallery on Home Page Excerpts…You’re welcome sir!
Forum: Fixing WordPress
In reply to: Can You Displaya post’s gallery on Home Page Excerpts…Something like this should work for you – inside the loop of course…
<?php if ( strstr( $post->post_content, '[gallery' ) ) echo do_shortcode('[gallery columns="5"]'); ?>Forum: Fixing WordPress
In reply to: Alphabetized categories with headers a – zThere’s a thread here which may shed some light on this for you:
http://ww.wp.xz.cn/support/topic/288774?replies=20It deals with taxonomies, but in WordPress “Categories” are just another form of Taxonomy.
Forum: Themes and Templates
In reply to: wp_get_archives outputs m= for year instead of year=Hi,
I just tested the code that you posted on my development server and it seems to work fine. The “m” query var is not actually an error. If it is present and only contains 4 digits, then it defines a year. My guess is that your theme does not include an archives.php file and that there is some sort of custom query action going on in either index.php or home.php which may be overwriting WordPress’ built-in query. This interference could also be caused by a plugin – not sure which one would do this though.I would suggest trying to isolate the bit of code that is interfering with the query as over writing “m” with “year” could cause un-forseen complications if you ever change the arguments passed to wp_get_archives.
Hopt this helps in some way…
Forum: Plugins
In reply to: Document RepositoryYour site seems to be “Powered By ActiveSite” and not WordPress.
Forum: Fixing WordPress
In reply to: Display and separate posts by tags?No problem 🙂
Forum: Themes and Templates
In reply to: interesting wp themeThis should get you started: http://wordpress.pastebin.ca/1761285
Forum: Fixing WordPress
In reply to: Display and separate posts by tags?You should be able to create a link to any term index by using the get_term_link() function. Here is a working example of this function for a tag with the name “Bunny”:
<a href="<?php get_term_link( 'bunny', 'post_tag' ); ?>">Bunnies</a>As far as having posts with the “featured” tag show up on the homepage, please try using query_posts() before your loop in either index.php or home.php. Something like this should work:
query_posts('tag=featured');Forum: Themes and Templates
In reply to: How to List Uncategorized Posts only?Have you tried to checnge the first few lines of your code to:
<div id="copy"> <?php query_posts('category_name=Uncategorized'); if (have_posts()) : ?>This should do the trick. You might also want to read up on the query_posts() function as it can work magic on The Loop 🙂
I am a newbie. I just upgrade from 2.8.6 to 2.91 without deleting the files, and deactivate the plugins.
This should not be a problem unless you are experiencing a problem. I believe that these procedures were put in place to minimize the oodles of things that could go wrong during an upgrade.
Should you follow these steps?
Yes.Will not following them create a problem?
Sometimes.It’s best to take every precaution in my experience!
Forum: Fixing WordPress
In reply to: Why does it search for “ie_hacks.css” in the post subdirectories?Sorry, I have no idea – I don’t really answer CSS questions here.
Forum: Fixing WordPress
In reply to: Content conditionally displayed depending upon last page visited?tictock – spelling seems to be one of my downfalls as well 😉 Glad I could help.
Forum: Fixing WordPress
In reply to: Content conditionally displayed depending upon last page visited?Stef, This wordked for me in 2.9.1:
switch( wp_get_referer() ) { case 'http://example.org/' : /* Do Stuff here */ break; default : /* Don't forget to add a default case :) */ break; }