WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Creating custom hovertips for Categories (7 posts)

  1. smigdig
    Member
    Posted 3 years ago #

    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

  2. esmi
    Forum Moderator
    Posted 3 years ago #

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

  3. smigdig
    Member
    Posted 3 years ago #

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

  4. esmi
    Forum Moderator
    Posted 3 years ago #

    Your category listings.

  5. smigdig
    Member
    Posted 3 years ago #

    <!-- 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>
  6. esmi
    Forum Moderator
    Posted 3 years ago #

    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>
  7. smigdig
    Member
    Posted 3 years ago #

    Perfect! You can see it working on oxstones.com

    Thanks for your help again!
    Adam

Topic Closed

This topic has been closed to new replies.

About this Topic