WordPress.org

Ready to get started?Download WordPress

Forums

Adding code to all posts in semilogic theme (4 posts)

  1. Sridhar Katakam
    Member
    Posted 8 years ago #

    I want to add Google adsense code at the end of all posts by editing the appropriate template file. But the problem is, I don't understand which file I should edit. Usually in most themes, it would be something like 'posts.php', but there's nothing like that in this theme.

    This is the list of files: http://img467.imageshack.us/img467/5628/semilogic7qj.gif

  2. Samuel Wood (Otto)
    Tech Ninja
    Posted 8 years ago #

    Semilogic uses an unusual plugin system, so to edit this stuff you'd need to edit the proper plugin code for it. Look in the plugins/sem-theme directory. Probably something in there needs to be modified.

  3. Sridhar Katakam
    Member
    Posted 8 years ago #

    Thanks for the reply. I located the php file. I put

    echo "test";

    where I want to insert the google ads and it works fine. But when I replace that with the ad code, the page is blank. How do I convert the code so it is PHPized, i.e., is there a way to automatically put the 'echo' statements in front of the code and take care of the other syntax as well?

  4. Samuel Wood (Otto)
    Tech Ninja
    Posted 8 years ago #

    srikat: Around the adsense code, add ?> and <?php tags. The first one turns off php, the second turns it back on.

    Also be careful not to make your change add the Adsense code more than three times on any given page, like the front page. That would break Google's rules.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags