Customization to template based on post type?

This topic contains 1 reply, has 2 voices, and was last updated by  Paolo 8 years, 2 months ago.

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
  • Author
    Posts
  • #387249

    Hello,

    I have the custom post types plugin and want to show the author of the post on just one post type. I’ve found another forum thread here to help me show the post author:

    I’ve added the following code to the geodirectory_template_actions.php in wp-content/plugins/geodirectory file

    <br>Listed by <?php the_author(); ?><br>

    However I’m stuck on trying to figure out an if statement that helps me only show this code for certain post types (specifically places). Any suggestions

    #387407

    Paolo
    Site Admin
    Post count: 31211

    Hi,

    you shouldn’t modify the plugin file, or you’ll lose changes after every update. You should use actions and filters to add it to the template via code snippets plugin or a child theme functions.php file.

    Where do you want to add it?

    This is the conditional tag for the CPT:

    if ( ‘gd_place’ == get_post_type() ) {// code here }

    Thanks

Viewing 2 posts - 1 through 2 (of 2 total)

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
20% Discount Offer
Hurry! Get your 20% discount before it expires. Get 20% Discount