WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] Creating custom hovertips for Categories

[Resolved] Creating custom hovertips for Categories

  • smigdig

    @smigdig

    Hello,

    Currently, when you hover over one of the categories on Oxstones.com, i.e. ‘Announcements,’ you see a hovertip that says, ‘View all posts in Announcements.’

    How could I change this to display the Category Description, rather than the name?

    Thanks!
    Adam

Viewing 6 replies - 1 through 6 (of 6 total)
  • esmi

    @esmi

    Forum Moderator

    What code are you using to generate those boxes at the foot of the page?

    smigdig

    @smigdig

    Which boxes? What’s in them? The ads?

    esmi

    @esmi

    Forum Moderator

    Your category listings.

    smigdig

    @smigdig

    <!-- Announcements -->
    <ul class="latest">
    <?php $feature_post = get_posts( 'category=26&numberposts=1' ); ?>
    <?php foreach( $feature_post as $post ) : setup_postdata( $post ); ?>
    <li><h2 class="latest"><?php the_category(' '); ?></h2></li>
    <?php endforeach; ?>
    <?php $feature_post = get_posts( 'category=26&numberposts=3' ); ?>
    <?php foreach( $feature_post as $post ) : setup_postdata( $post ); ?>
    <?php if (function_exists('c2c_get_custom')) : ?>
     <li><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">
    		<?php echo c2c_get_custom('post-image','<img src="','" alt="<?php the_title(); ?>" class="post-image" />',''); ?></a></li>
    <?php endif; ?>
      		<li class="list-time"><?php the_time('d'); ?>.<?php the_time('M'); ?></li>
      		<li class="list-title"><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></li>
      		<li class="latest-excerpt"><?php the_excerpt(); ?></li>
    <?php endforeach; ?>
    </ul>
    esmi

    @esmi

    Forum Moderator

    Try changing:

    <li><h2 class="latest"><?php the_category(' '); ?></h2></li>

    to:

    <?php $thisCat = get_category( '26' );
    $thisCat_permalink = get_category_link( '26' );?>
    <li><h2 class="latest"><a href="<?php echo $thisCat_permalink; ?>" title="<?php echo $thisCat->category_description;?>"><?php echo $thisCat->name;?></a></h2></li>
    smigdig

    @smigdig

    Perfect! You can see it working on oxstones.com

    Thanks for your help again!
    Adam

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘[Resolved] Creating custom hovertips for Categories’ is closed to new replies.