[wp-trac] [WordPress Trac] #14780: get_category_link() and / or single_cat_title() not working in 3.0.1

WordPress Trac wp-trac at lists.automattic.com
Sat Sep 4 08:50:02 UTC 2010


#14780: get_category_link() and / or single_cat_title() not working in 3.0.1
--------------------------+-------------------------------------------------
 Reporter:  gazouteast    |       Owner:                                          
     Type:  defect (bug)  |      Status:  new                                     
 Priority:  normal        |   Milestone:  Awaiting Review                         
Component:  Template      |     Version:  3.0.1                                   
 Severity:  normal        |    Keywords:  bug, get_category_link, single_cat_title
--------------------------+-------------------------------------------------
 As the title says ...

 For verification, I have a fair number of sites all running the same
 theme, which has been layout tweaked to suit each one - the code in the
 templates remains the same on each other than layout and some CSS
 variations.

 Under 2.9.2 (e.g at FlamingFood.com) you can see the category names and
 links in the grey bar at the head of each category's excerpts on the home
 page (view that first so you can see the example of it working)

 Under 3.0.1 (e.g. at BuildaSkill.com/blog and GazLanNaThai.com/eye) -
 scroll down past the first 1/3 page to the category columns on those - the
 category titles do not display in the grey bar at the head of each group
 of category excerpts in each column.

 I have checked and rechecked the code and there is no difference in the
 base block to create the category title and link.  I've scoured the codex
 to find a deprecation notice and there is none.  The category titles on
 the 3.0.1 sites did work under 2.9.2 (and all the way back to 2.5), but
 under 3.x they don't.

 I have no idea why, but [http://core.trac.wordpress.org/ticket/14161
 14161] might be related, ditto for
 [http://core.trac.wordpress.org/ticket/13373 13373] in which nacin
 describes get_category_link() as a WP_Error object - huh?  It's a standard
 template tag according to the codex.

 I've done all the usual debugging stuff and still cannot get this to
 return to the same functionality it displayed under 2.9.2 - it's also
 consistent across all my sites, the calling code in the home page template
 (index.php) is (using first column off gazlannathai.com) -

 {{{
 <?php
 // enter the IDs of which categories you want to display
 $display_categories = array(395);
 foreach ($display_categories as $category) { ?>
     <div class="clearfloat">
       <div class="catwrap">
       <?php query_posts("showposts=10&cat=$category");
             $wp_query->is_category = false;
                 $wp_query->is_archive = false;
                 $wp_query->is_home = true;
                  ?>
       <div class="cat-head">
         <h3><a href="<?php echo get_category_link($category);?>">
           <?php
         // name of each category gets printed
           single_cat_title(); ?>
           </a></h3>
       </div>
       <?php while (have_posts()) : the_post(); ?>
       <?php
 // this grabs the image filename
         $values = get_post_custom_values("home-category-image");
 // this checks to see if an image file exists
         if (isset($values[0])) {
 ?>
       <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent
 Link to <?php the_title(); ?>"><img class="home-cat-img" src="<?php
 bloginfo('url'); echo '/'; echo get_option('upload_path'); echo '/';
 $values = get_post_custom_values("home-category-image"); echo $values[0];
 ?>" alt="image" /></a>
       <?php } ?>
       <h5><a href="<?php the_permalink() ?>" rel="bookmark" class="title">
       <?php
 // this is where title of the article gets printed
           the_title(); ?>
       </a></h5>
       <?php the_content_rss('', TRUE, '', 50); ?><br /><br />
       <?php endwhile; ?>
       </div>
     </div>
 }}}

 That's the per category block / loop which appears in a column div - the
 other columns are the same but with more categories in the array and fewer
 posts per category.

 As I said - it worked fine from 2.5 to 2.9.2, but is banjaxed in 3.0.x and
 everything is pointing to something in core in the two functions named in
 the title.

 Gaz

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/14780>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list