• Resolved ddeuster

    (@ddeuster)


    On our site we have a section that contains articles of our online publication written by several different authors. Knowing we did not want to give every one of those contributors an account, we opted to included a taxonomy called ‘writers. On our page posts we would like to have our main editor’s name appear as the_author_post unless there is a taxonomy checked. Below is the code we currently are using.

    <?php if(taxonomy_exists('writers')){echo get_the_term_list($post->ID, 'writers');} else {
              ?>
    <?php the_author_posts_link(); } ?>

    Unfortunately the_post_author will not show up on pages where there is not a writer assigned to the post through the taxonomy. What are we missing in our if/else code.

    Thanks in Advance.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Are you sure the call to the_author_posts_link is inside the loop? You may have to share more of your template file for us to help figure out what’s gone wrong.

    Okay. Sorry. I’ve taken my testing a bit further and am running into the same problem.

    Doh.

    Your first condition is always true. The *taxonomy* “exists” irrespective of whether or not the particular post has a writer associated with it.

    Try this condition instead:

    if (has_term('','writers')) {

    Thread Starter ddeuster

    (@ddeuster)

    Tried but with no success. It seems to be passing looking for writer and going strait to the_author_post.

    Thread Starter ddeuster

    (@ddeuster)

    Nevermind. I had misread what you had typed. Thanks so much for the solution.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Taxonomy and Author Post issue’ is closed to new replies.