WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] Adding signature to posts

[Resolved] Adding signature to posts

  • Hello,

    I am in the process of building my gaming website and want to creating something like a signature with every post, changing depending on the author. I realize there are plugins that do this but I do not want to do this at the end of each post.

    Demonstrated in this single post, I would like the banner to function as the signature. Which is obviously the one that clearly states my intentions in a white box, haha.

    To place that, my theme uses: <?php include ('editable/ads/post-top.php'); ?>

    And the PHP file simply is the HTML to post an image in a DIV.

    It’s apparent that it’s the PHP file I will have to edit, but the question that brings me here is how to set it up? I would like it to display, say, image1.png when I post and image2.png when Author2 posts, etc. Any ideas?

Viewing 4 replies - 1 through 4 (of 4 total)
  • esmi

    @esmi

    Forum Moderator

    How about:

    <?php
    switch ( $post->post_author  ) {
    	case 1:
    	[display image 1 ]
    	break;
    
    	case 2:
    	[display image 1 ]
    	break;
    
    	default:
    	[ display default image or no image ]
    }
    ?>

    where the numbers = the author ids?

    I don’t seem to be getting that to work, but then again I am fairly new to PHP. Just for clarification, what specifically are the editable parts to that?

    esmi

    @esmi

    Forum Moderator

    You need to replace [display image x ] with your image code for that particular author.

    Okay, that’s what I thought.
    A few parse and human errors later and I’ve got it figured out! Epic. Many thanks.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Resolved] Adding signature to posts’ is closed to new replies.
Skip to toolbar