WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] category specific info included in post page (3 posts)

  1. roadchild
    Member
    Posted 5 years ago #

    Is there a way to include a link at the bottom of a post if it's in a specific category?
    For instance, I am working on a site for Spaniel rescue and using the posts to manage the adoptable dogs. What I want to do is include a link at the bottom of any posts categorized "adoptable-dogs" . I don't want the link to appear on any other posts. Is there a way to do this?
    I am trying to automate the postings as much as possible so they have less to do with technical stuff and can spend time getting the dogs homes.

    Thanks!

  2. MichaelH
    Member
    Posted 5 years ago #

    Use the Conditional Tag in_category. The Loop article also shows a test for category that should inform you.

    If using the WordPress Default theme, then in wp-content/themes/default/index, place this code right before <?php endwhile; ?>

    <?php
    if ( in_category(3) ) {
    echo '<a href="http://wordpress.org/support/topic/273246?replies=1">Example Link</a>';
    }
    ?>
  3. roadchild
    Member
    Posted 5 years ago #

    Ahh thank you!

Topic Closed

This topic has been closed to new replies.

About this Topic