WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Adding signature to posts (5 posts)

  1. EMF_saurus
    Member
    Posted 4 years ago #

    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?

  2. esmi
    Forum Moderator
    Posted 4 years ago #

    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?

  3. EMF_saurus
    Member
    Posted 4 years ago #

    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?

  4. esmi
    Forum Moderator
    Posted 4 years ago #

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

  5. EMF_saurus
    Member
    Posted 4 years ago #

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

Topic Closed

This topic has been closed to new replies.

About this Topic