WordPress.org

Forums

Byline
[resolved] Showing the descriptions (2 posts)

  1. delawaresmith
    Member
    Posted 1 year ago #

    I added this to my single.php, but then it shows all author and descriptions on all pages. Same issue as pwocken.

    It's a test site, but you can see it live here - http://www.hereismysite.info/monster-santa/

    <?php //old code here;
           //more old code ();
           //last line of old code;
           //You can add a comment here, to remind you why there is new code below
           $terms = get_terms("byline");
              $count = count($terms);
              if ( $count > 0 ){
                 echo "
    
    <ul>";
                    foreach ( $terms as $term ) {
                         echo "<h6>About " . $term->name . "</h6>";
                         echo "<p>" . $term->description . "</p>";
                                                 }
                  echo "</ul>
    ";
                               }
    ?>

    [Moderator Note: Please post code & markup between backticks or use the code button. Your posted code may now have been permanently damaged by the forum's parser.]

    https://wordpress.org/plugins/byline/

  2. mattdu
    Member
    Plugin Author

    Posted 1 year ago #

    OK, this post revealed a flaw in my previous code.

    Replace this line:
    $terms = get_terms("byline");

    With this line:
    $terms = get_the_terms($post->ID, 'byline');

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Byline
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic

Tags

No tags yet.