• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

Author not displaying in meta data for single custom post type

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › Design Tips and Tricks › Author not displaying in meta data for single custom post type

This topic is: not resolved

Tagged: .post-info, Custom Post Type, missing author

  • This topic has 5 replies, 2 voices, and was last updated 10 years, 1 month ago by marjwyatt.
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • April 19, 2013 at 3:34 am #36338
    marjwyatt
    Member

    I'm stuck and I'm hoping someone in here can help me understand what I'm doing wrong. This is a custom theme built on the sample child theme code offered here at StudioPress.

    Here is my problem statement, with accompanying code...

    The author shows up in archives displaying the custom post type but does not show up on the single display of that custom post type.

    Here is a link to my custom post type declaration: http://pastebin.com/hNuGmcqK
    Here is a link to my single-customtype.php: http://pastebin.com/Cpa2zwrt

    At the bottom of that script, you'll notice two echo statements. The first one is displaying the author, and that's great. Here's that line of code:
    `<?php echo 'This post was contributed by ' . get_the_author_meta('display_name') . ''; ?> `

    In the second echo, I am trying to use a variable to echo the same data, using the same function that is working in the above statement and nothing displays.
    second echo's variable: `$another_artist = get_the_author_meta('display_name');`
    second echo's output code:
    `<?php echo 'This post was contributed by ' . $another_artist . ''; ?>`

    Here is a link to a single post type rendered by the above code at the development environment:
    http://creativeconundrum.com/freshfaces/songs/blues/song-title/

    I'm truly baffled and I'm hoping that some smart person here can point me at the missing piece of the puzzle that my brain just can't seem to find.


    Virtually Marj Wyatt
    VirtuallyMarj.com | Twitter | Facebook | Google +

    http://creativeconundrum.com/freshfaces/songs/blues/song-title/
    April 19, 2013 at 10:41 am #36396
    daveyank
    Member

    It looks like you're executing lines 60-67 of single-customtype.php outside of the loop. Try executing those after the "while" statement on line 71.

    April 19, 2013 at 11:23 am #36412
    marjwyatt
    Member

    Thanks for your reply and suggestion, Dave, but those lines are not excluded.  The variable $postid is being used successfully inside the loop to extract the custom fields and display them.

    To show this to you (or anyone looking on), I am echoing the category slug just under the play button of the media.  See this page:
    http://creativeconundrum.com/freshfaces/songs/song-title/

    Any other ideas?  I'm trying to get the author into the post info area and I just can figure out why it shows in archive displays and not on the single post itself...

    Archive display link:

    http://creativeconundrum.com/freshfaces/blues/


    Virtually Marj Wyatt
    VirtuallyMarj.com | Twitter | Facebook | Google +

    April 19, 2013 at 11:35 am #36415
    daveyank
    Member

    That's because get_the_category() can execute outside of the loop. get_the_author_meta() will only work outside the loop if you explicitly pass a userID to it. Here's one way to do it if you don't want to move that line of code:

    `get_the_author_meta('display_name',get_queried_object()->post_author);`

    April 19, 2013 at 11:51 am #36421
    marjwyatt
    Member

    Hi Dave,

    Nope ... moved that variable just after the while and again after the_post() and nothing has changed.

    And I still would like to know why the author is missing from the post info right next to the date when it shows up in archives.  That is really what I'm trying to accomplish.  All the echoing inside the post itself was to see if the code knew who the author was.


    Virtually Marj Wyatt
    VirtuallyMarj.com | Twitter | Facebook | Google +

    April 19, 2013 at 5:08 pm #36460
    marjwyatt
    Member

    Thanks Dave ... with your help, I was able to sort out a method to isolate the ID for the after post in content accordion menu but I still don't have an answer as to why the post info for my custom post type is missing information that it has for archives.

    I'll soldier on and come back with the final & functional code.


    Virtually Marj Wyatt
    VirtuallyMarj.com | Twitter | Facebook | Google +

  • Author
    Posts
Viewing 6 posts - 1 through 6 (of 6 total)
  • The forum ‘Design Tips and Tricks’ is closed to new topics and replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2023 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble