In a website I'm building (using my own designed theme, for a business site that doesn't have a blog, IOW, using WP for it's CMS), I have 5 templates: the homepage, the 404 page, the default (page.php), a small one-column and a large one-column. I use the default template for 6 pages in the site. That template is 2-column with a wide main column and narrower right column. But each page will have different content in the right column - mostly text - so it's really not a "sidebar" situation. I want to use the plugin "Multiple Content Blocks".

I used it in the homepage template and it's easy and works beautifully, but all I had to do was place this code:

<?php the_block('blockname'); ?>

in the template in my "colR" div. In actual fact the code is:

<?php the_block('News'); ?> 

as I named the block "News".

So far so good.

In the readme.txt it has the following FAQ: How do I filter the content?, and it says:

"Use the function get_the_block instead of the_block, like this: <?php $content_to_edit = get_the_block('blockname'); ?> and you can now edit this variable with PHP."

I'm ASSUMING (perhaps incorrectly) that this means I can write a function or filter for the plugin -- what I want to be able to do is name a block for each of the six pages, and then in the page.php template, be able to specify "if this page, use this block" but I don't know how to write it.

So, for example, if one of the pages is called "customer", or ID 21, and I want to name the content block "contact", what exactly goes in the $content_to_edit part? I've tried a couple things but they haven't worked.

Also, would it need to go inside the loop? In my page.php I have the loop above the colR (for column right) div.

Help greatly appreciated!

  • I was misunderstanding how the plugin worked. One block accepts different content from different pages - only need one.
    – PVA
    Commented Jan 29, 2012 at 17:51

1 Answer 1


I misunderstood how the plugin worked. I can use one "block" call in a template and it shows different content from different pages. Do NOT need a different block for every page. MY BAD.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.