loewydesign / wordpress-layout-builder

Integration of Layout Builder into WordPress in the form of a plugin. Layout Builder simplifies the placement of elements into sophisticated grids.
GNU General Public License v2.0
0 stars 1 forks source link

`LayoutBuilder\Output::render()` echos content, but `[layout]` shortcode should return, not echo #3

Closed agopshi closed 8 years ago

agopshi commented 8 years ago

Right now, the [layout] shortcode essentially echos out the layout because LayoutBuilder\Output::render() echos it. This isn't a big problem on pages that only use a layout and nothing else, but it causes problems for pages that mix one or more layouts and other content.

Proposed fix:

  1. Add an $echo = true parameter to LayoutBuilder\Output::render(). This will maintain backwards compatibility, and if it's set to false, it should return the output.
  2. Change the [layout] shortcode to use $echo = false when calling LayoutBuilder\Output::render(). This should fix the shortcode without breaking any existing code.
ghost commented 8 years ago

Added $return = false parameter instead of $echo = true to keep return/direct output parameter name consistency.