Post Layout

Post Layout lets blog owners to inject “code” into posts and pages without modify the theme and create a new “layout” for them. “Code” is everything: from simple text to AdSense Javascript, from subscription form fields to PHP code.

Post Layout now incorporates all the Post Layout Pro features. Post Layout Pro has been dismissed and you can safely replace it with the free Post Layout (from the WordPress Plugin Repository).

Most of the things can be done with the Header and Footer plugin as well.


Here a list of all the features of Post Layout Pro. This list can help you to understand when Post Layout Pro is of help for your needs.

  • mobile detection system (lets you to differentiate the code to be “injected” when the blog is accessed by mobile devices)
  • three injection positions for posts: before, in the middle and after the post content
  • post level ability to suspend the injection (overall or for each position)
  • two injection position for pages and posts when displayed on home page, category pages, tag pages: above and below the content
  • per category code: you can inject different things in different categories (for multi categorized posts, the first one returned by WordPress is used)
  • last comment code injection: what about to put an AdSense block after the last comment?
  • comment form code injection
  • generic code blocks to be used thought the category configurations with auto offline date
  • compatible with Post Layout: if you’re using the free version of Post Layout you can update to the Pro version and the settings are kept

Usage example 1: adding AdSense

You want to insert the AdSense code (is one of the common task) before the post content, when a single post is displayed.

On the options panel, find the “Code to add before the post” textarea and copy the AdSense code:


suddenly it will display in you blog:


Example 2: adding code per category

You are ready for a new affiliate marketing campain. But it is a wellness related product and your blog has a wellness category and a chemistry category too. You don’t want to put wellness ads in the chemistry posts… easy! Suppose we want to add the ads  below the post content. Find in the options panel the “Code to add before the post”, change to a desired category, and add the affiliate code.


now look at your posts: only the ones in the wellness category will have the ads. The first one is in the wellness category the second not and the latter still has the AdSense.



But, you say, i want to keep the default AdSense even if I set specific code for a category. Yes, you can of course. Add the “[ default ]” special tag in the category code block and it will be replaced with default code block. So you can merge two different code blocks in the way you prefer.


This is the result


Working examples of  Post Layout Pro can be found in this blog. Every posts show something.

You can check all posts related to Post Layout and all posts with Post Layout examples.


WordPress 2.7 has introduced comment pagination and comment thread. That leads to some issue on injection of code after the last comment. May be this feature doesn’t works well or doesn’t work at all.

If your theme is not fully compliant with the default theme structure and function calls, some injection may not work. Try Post Layout before and notify me any issue at

My excuses for my bad english but it's the only way I have to communicate with you. Would you suggest a correction? Leave a comment, thank you!

2 thoughts to “Post Layout”

  1. Hi,

    I tried t use your plugin. Nice.

    However, I now want to change the code that I inserted via your plugin. But impossible to understand where to find it and modify.

    Do you have a feature helping for that ?
    Or can you tell me where is the code I inserted in “single post” / “before the post”.

    This would help me so much.



  2. Hello,
    first of all, thank you for this very useful plugin.
    It seems that post layout doesn’t work well with AMP pages (with the AMP plugin from Automattic).
    I use it to add a message after each post article. It works fine on regular pages .
    But on AMP pages, it displays the message before the post and after the post.
    Here is the normal page :
    and here the AMP page :
    As you can see, my message appears twice on the AMP page : before and after the post.
    I don’t know what is the cause but I just wanted to let you know about this plugin behaviour.
    I have put a screenshot of my configuration. It is very simple. and I don’t use the mobile detection.
    Thank you and have a nice day.

Leave a Reply