Support » Fixing WordPress » Add html code to a page via theme based on body class

  • I would like to add some code to a theme that adds some html code to a page or post based on the body class of a page/post. The user would add a custom body class in the page/post editor when creating the post. Different custom classes would have different images displayed. Something like below:

    if body class="class name" {
    			echo '<img src="http://www.website.com/image.jpg">';
    		}

    Disclaimer, I have no php programming knowledge. My experience has been limited to being able to copy some code and use it other places.
    I know I have the first line completely wrong just trying to convey what I want to do.

    Regards

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Add html code to a page via theme based on body class’ is closed to new replies.