• Resolved philgreen

    (@philgreen)


    I created a block that is to be an inset box floated inside of a block of text, the way that align-right works for images.

    I can put “float:right” on the div, and that works, but now I can’t click on the block to select in the editor. Is there some way built into wordpress to float non-image blocks like this custom block?

    • This topic was modified 4 years, 8 months ago by philgreen.
    • This topic was modified 4 years, 8 months ago by philgreen.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Ryan Kienstra

    (@ryankienstra)

    Hi @philgreen,
    Maybe you know about this, but there’s a way to add a CSS class and get it in the template with block_value( 'className' )

    https://cldup.com/sPm-cAeECd.png

    Then, maybe you could add styling floating that.

    Is that what you had in mind?

    • This reply was modified 4 years, 8 months ago by Ryan Kienstra.
    Thread Starter philgreen

    (@philgreen)

    No that’s not what I mean, sorry. I have float:right in the template. It looks something like this:

    <style>
    .inset-box{border:1px solid #cccccc;width:400;float:right;margin:0 0 2em 2em;}
    </style>
    <div class=”inset-box”>
    <p><?php block_field( ‘text’ ); ?></p>
    </div>

    When I add it to the editor, it floats properly into the paragraph block that’s underneath and displays properly. The problem is that I can’t click on it in the editor. What am I doing wrong?

    Plugin Author Ryan Kienstra

    (@ryankienstra)

    Hi @philgreen,
    Sorry for the delay.

    Maybe this is just from copying it, but could you please try replacing backticks with single quotes in block_field( 'text' )

    For example, right now, it’s using backticks:

    block_field( ‘text’ )

    Plugin Author Ryan Kienstra

    (@ryankienstra)

    Closing, but feel free to comment if that didn’t help. Have a great weekend.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Floating a block’ is closed to new replies.