How to move Contextual Links? Added a wrapper inside a block.tpl.php called block-content:

&lt;section id="&lt;?php print $block_html_id; ?&gt;" class="&lt;?php print $classes; ?&gt; clearfix"&lt;?php print $attributes; ?&gt;&gt;
    &lt;div class="block-content"&gt;

  &lt;?php print render($title_prefix); ?&gt;
  &lt;?php if ($title): ?&gt;
    &lt;h2&lt;?php print $title_attributes; ?&gt;&gt;&lt;?php print $title; ?&gt;&lt;/h2&gt;
  &lt;?php endif;?&gt;
  &lt;?php print render($title_suffix); ?&gt;

  &lt;?php print $content ?&gt;
    &lt;/div&gt;

&lt;/section&gt;


As you can see there is no sign of contextual links in it.

But if you look at the source, contextual links block is put inside the new block-content.



How to move contextual links block outside block-content one level up inside section so they both become children elements?

Goal is to separate block content wrapped in a separate container without contextual links because it interrupts a lot when it comes to CSS.

I got a solution with jQuery, but it's impractical on every page load for every block.
you can create multiple tpl.php files for blocks based on the specific block, the module that created the block.


  Clone block.tpl.php to "block--block--[block-id].tpl.php" file


after try code, I don't' encourage you to do this, but it maybe the solution for you:

&lt;section id="&lt;?php print $block_html_id; ?&gt;" class="&lt;?php print $classes; ?&gt; clearfix"&lt;?php print $attributes; ?&gt;&gt;
    &lt;div class="block-content"&gt;
      &lt;?php print render($title_prefix); ?&gt;
      &lt;?php print render($title_suffix); ?&gt;
      &lt;?php if ($title): ?&gt;
        &lt;h2&lt;?php print $title_attributes; ?&gt;&gt;&lt;?php print $title; ?&gt;&lt;/h2&gt;
      &lt;?php endif;?&gt;
      &lt;?php print $content ?&gt;
    &lt;/div&gt;
&lt;/section&gt;


=> Clear cache