Get post_id outside of loop – Single Template to control Author meta display

Posted in: Newspaper
Post count: 27

Hello, Newspaper Support

We are trying to control by use of a Custom field (ACF) whether the Author Name of a particular post shows up or not.
We’ve tried plugins to control Post meta data (but not compatible with theme).
So, we are trying to do this by the code. So, we create a Custom Field with Advanced Custom Fields in Posts.

Now, we are trying to edit the Single Post template to hide or shows depending on the value of the Custom Field.

So, there we have a couple of questions here…
Which is the best file to edit to create the PHP/JS code to basically use code to hide/show Author meta data?
We tried Loop_Single.php but no luck (plus there are several in different areas).
So, the two questions are which file to edit to create a basic IF Statement with the value of the Custom Field…

Also, how do we get the Post_ID value from within the single template or other file when it is “outside the loop”?
I’d tried the : get_field(‘hide_author_name_on_post’); per ACF instructions…. but we don’t get it… and are outside any kind of Post loop.

We are not really sure what direction to go…so would appreciate any help you can give 🙂

Thank you 🙂

Tim

Post count: 21065

Hello Tim!

This will require custom work, which is not covered by the support team.
For customization and other services, you can contact our custom work team here: https://tagdiv.com/premium-customization-services/.

Thank you for understanding!

Viewing 2 posts - 1 through 2 (of 2 total)
The forum ‘Newspaper’ is closed to new topics and replies.