DotDragnet
February 04, 2012, 10:51:46 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Welcome to the new trading eye refugees
 
   Home   Help Search Login Register  
Pages: [1]   Go Down
  Print  
Author Topic: Newbie Problems with Wordpress  (Read 771 times)
danrocha
Newbie
*
Posts: 16



View Profile Awards
« on: August 05, 2010, 09:02:04 AM »

Hello Everyone,

I am very new to Wordpress but have managed to get my new blog up and running, however, there are two things that I cannot seem to work out how to do.

1. I cannot get the associated categories that a post is linked to, to display at the bottom of each post.
2. In the sidebar, I have the categories listed but it doesnt show a number next to each one to display how many posts match each category.

Now it worked when I had the default theme installed, but I have messed around with it and customised it a lot, now it doesnt work Sad.

Any help would be great,

Thanks,

Dan
Logged
Chris H
Resident God Botherer
Global Moderator
Hero Member
*****
Posts: 2281



lansburyslido
View Profile WWW Awards
« Reply #1 on: August 05, 2010, 09:04:39 AM »

Welcome Dan, there are a number of people on DDN who are pretty good with WP. I'm not one of them but I'm sure an answer will be along soon.
Logged

Mr Anderson
DDN Contribs
Hero Member
*****
Posts: 2209



ap4a.uk ap4a
View Profile WWW Awards
« Reply #2 on: August 05, 2010, 09:11:54 AM »

1. You need to use the_category; eg. <p>Posted in <?php the_category(',') ?></p>
2. You need to use show_count or show_post_count; eg. <?php wp_get_archives('type=monthly&show_post_count=1'); ?> or <?php wp_list_categories('show_count=1' ); ?>
« Last Edit: August 05, 2010, 09:13:29 AM by Mr Anderson » Logged

danrocha
Newbie
*
Posts: 16



View Profile Awards
« Reply #3 on: August 05, 2010, 09:18:13 AM »

Ok, thank you for this.

Could you please tell me where this code would go?

Thanks,

Dan
Logged
danrocha
Newbie
*
Posts: 16



View Profile Awards
« Reply #4 on: August 05, 2010, 09:19:37 AM »

This is my current Index.php code...

   <div <?php post_class() ?> id="post-<?php the_ID(); ?>">
       <h3 class="storytitle"><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h3>
      <!-- <div class="meta"><?php _e("Filed under:"); ?> <?php the_category(',') ?> &#8212; <?php the_tags(__('Tags: '), ', ', ' &#8212; '); ?> <?php the_author() ?> @ <?php the_time() ?> <?php edit_post_link(__('Edit This')); ?></div> -->
Logged
Mr Anderson
DDN Contribs
Hero Member
*****
Posts: 2209



ap4a.uk ap4a
View Profile WWW Awards
« Reply #5 on: August 05, 2010, 09:24:23 AM »

That would depend entirely on where you wanted it to appear.
Logged

danrocha
Newbie
*
Posts: 16



View Profile Awards
« Reply #6 on: August 05, 2010, 09:31:32 AM »

Ok, the first bit worked perfectly, I can now see the categories under each post - thank you very much for that.

The second part, the getting the number of posts per category in the sidebar, this doesnt work. All Im trying to achieve in the sidebar is that next to each category name, the number of relevant posts per category is shown. For example...

Categories

Photos (24)
People (12)

Does that make sense?

Thanks again,

Dan
Logged
Mr Anderson
DDN Contribs
Hero Member
*****
Posts: 2209



ap4a.uk ap4a
View Profile WWW Awards
« Reply #7 on: August 05, 2010, 09:45:31 AM »

What's your sidebar code look like at the moment?
Logged

danrocha
Newbie
*
Posts: 16



View Profile Awards
« Reply #8 on: August 05, 2010, 09:47:48 AM »

<ul>
<br />
<?php    /* Widgetized sidebar, if you have the plugin installed. */
      if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar() ) : ?>
   <?php wp_list_pages('title_li=' . __('Pages:')); ?><br>
    <br>
   
   <?php wp_list_bookmarks('title_after=&title_before='); ?><br>
    <br>
   
   <?php wp_list_categories('title_li=' . __('Places:')); ?>
   <?php wp_list_categories('show_count=1' ); ?><br>
 <li id="search">
   <label for="s"><?php _e('Search:'); ?></label>
   <form id="searchform" method="get" action="<?php bloginfo('home'); ?>">
   <div>
      <input type="text" name="s" id="s" size="15" /><br />
      <input type="submit" value="<?php esc_attr_e('Search'); ?>" />
   </div>
   </form>
 </li><br>
 <li id="archives"><?php _e('Archives:'); ?>
   <ul>
    <?php wp_get_archives('type=monthly'); ?>
   </ul>
 </li><br>
 <li id="meta"><?php _e('Meta:'); ?>
   <ul>
      <?php wp_register(); ?>
      <li><?php wp_loginout(); ?></li>
      <li><a href="<?php bloginfo('rss2_url'); ?>" title="<?php _e('Syndicate this site using RSS'); ?>"><?php _e('<abbr title="Really Simple Syndication">RSS</abbr>'); ?></a></li>
      <li><a href="<?php bloginfo('comments_rss2_url'); ?>" title="<?php _e('The latest comments to all posts in RSS'); ?>"><?php _e('Comments <abbr title="Really Simple Syndication">RSS</abbr>'); ?></a></li>
      <li><a href="http://validator.w3.org/check/referer" title="<?php _e('This page validates as XHTML 1.0 Transitional'); ?>"><?php _e('Valid <abbr title="eXtensible HyperText Markup Language">XHTML</abbr>'); ?></a></li>
      <li><a href="http://gmpg.org/xfn/"><abbr title="XHTML Friends Network">XFN</abbr></a></li>
      <li><a href="http://wordpress.org/" title="<?php _e('Powered by WordPress, state-of-the-art semantic personal publishing platform.'); ?>"><abbr title="WordPress">WP</abbr></a></li>
      <?php wp_meta(); ?>
   </ul>
 </li>

<?php endif; ?>
Logged
Mr Anderson
DDN Contribs
Hero Member
*****
Posts: 2209



ap4a.uk ap4a
View Profile WWW Awards
« Reply #9 on: August 05, 2010, 10:00:46 AM »

This part needs to be combined:

Code:
<?php wp_list_categories('title_li=' __('Places:')); ?>
   <?php wp_list_categories('show_count=1' ); ?>

eg. to


Code:
<?php wp_list_categories('show_count=1&title_li=' __('Places:')); ?>
Logged

danrocha
Newbie
*
Posts: 16



View Profile Awards
« Reply #10 on: August 05, 2010, 10:05:56 AM »

No, still no joy but thanks anyway, really appreciate it.

My code now looks like this...

<br />
<?php    /* Widgetized sidebar, if you have the plugin installed. */
      if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar() ) : ?>
   <?php wp_list_pages('title_li=' . __('Pages:')); ?><br>
    <br>
   
   <?php wp_list_bookmarks('title_after=&title_before='); ?><br>
    <br>
   
   <?php wp_list_categories('show_count=1&title_li=' . __('Places:')); ?>
   
 <li id="search">
   <label for="s"><?php _e('Search:'); ?></label>
Logged
Mr Anderson
DDN Contribs
Hero Member
*****
Posts: 2209



ap4a.uk ap4a
View Profile WWW Awards
« Reply #11 on: August 05, 2010, 10:09:26 AM »

Do you have that sidebar code in your functions.php file? If you're using a widget sidebar you need to set it to work in there.
Logged

danrocha
Newbie
*
Posts: 16



View Profile Awards
« Reply #12 on: August 05, 2010, 10:12:50 AM »

No, my functions.php reads like this.

if ( function_exists('register_sidebar') )
   register_sidebar(array(
      'before_widget' => '<li id="%1$s" class="widget %2$s">',
      'after_widget' => '</li>',
      'before_title' => '',
      'after_title' => '',
Logged
Mr Anderson
DDN Contribs
Hero Member
*****
Posts: 2209



ap4a.uk ap4a
View Profile WWW Awards
« Reply #13 on: August 05, 2010, 10:34:48 AM »

In your admin go to appearance --> widgets, open up the sidebar, and select the categories widget. In there you can tick and save the option to show post counts.
Logged

danrocha
Newbie
*
Posts: 16



View Profile Awards
« Reply #14 on: August 05, 2010, 12:06:25 PM »

Fantastic, thank you both!

Dan
Logged
Pages: [1]   Go Up
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF | SMF © 2006-2008, Simple Machines Valid XHTML 1.0! Valid CSS!