php - Wordpress: problem in loop -


so have following code:

    <?php     query_posts("order=asc&cat=4"); ?>               <?php if(have_posts()): while(have_posts()): the_post(); ?>     <?php if(get_post_custom_values("show") != null): ?>     <?php         $categories = get_cat_id(get_the_title());         $url = get_category_link($categories);     ?>     <li class="thumb">         <a href=""><?php the_post_thumbnail(array(215,200)); ?></a>         <h2><a href=""><?php the_title(); ?></a></h2>     </li>     <?php endif; ?> <?php endwhile; endif; ?>    </ul> 

this code works, when have & - in title $categories = get_cat_id(get_the_title()); .. get_cat_id won't work, know work around?

try get_category_by_slug instead. fetching id name of category messy, duplicates , characters, you've discovered.


Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -