• Resolved ArtGoddess

    (@artgoddess)


    Hello, I kindly ask how can I insert the “Post Date” block into the “Table” block. Even if I have the cursor inside the cell, when I click on the “Post Date” block it inserts the date outside the table. Many thanks!

Viewing 4 replies - 1 through 4 (of 4 total)
  • Moderator jordesign

    (@jordesign)

    Hey @artgoddess as it stands – the Table block is designed to have text within it – but not have other blocks inserted.

    Can you tell me a little more about the layout you’re hoping to achieve by having the post date within a Table? It’s possible there are other layout options (like Stack/Row) which may help with it.

    Thread Starter ArtGoddess

    (@artgoddess)

    Thank you, @jordesign, for your answer.

    The code of this block is:

    <!-- wp:post-date {"format":"Y"} /-->

    And the output is:

    <div class="wp-block-post-date"><time datetime="2023-09-16T12:48:16+02:00">2023</time></div>

    But when I enter manually, in code view, the gutenberg code into the table, there is no output.

    I can’t even place it into a paragraph.

    I need to show this data in a Custom Post Type that has a lot of information, and the table is the best way to show all the stuff. Sample:

    https://quickforget.com/s/b57a4644bc9ffd4a23879c2cb3e1ebf496d49f7bd63f22fa

    Is there any way to only output the time tag, and use this element everywhere we need in the post?

    Thank you very much.

    Moderator jordesign

    (@jordesign)

    Hey @artgoddess – thanks so much for the screenshot and explanation of the format. I do know there are discussions within the project about being able to insert metadata like that inline within paragraphs – but it’s not something on the horizon yet.

    The best way to approach a layout like that would be to skip the Table block altogether and instead insert Row blocks in this kind of format…

    – Row
    – Paragraph
    – Paragraph
    – Separator (for the border/rule)
    – Row
    – Paragraph
    – Paragraph
    etc…

    You’d be able to set a width on the first paragraph of each row – to maintain the alignment and look of a table – but also have more flexibility of what elements/blocks you can use.

    Thread Starter ArtGoddess

    (@artgoddess)

    Thank you very much for your answer. Yes, I’ll try additional formats.

    For the time being, I have created the shortcode [post-date-year]:

    function get_post_date_year() {
         return get_post_time( 'Y' );
    }
    add_shortcode('post-date-year', 'get_post_date_year');

    Maybe it helps others. Thank you again for assistance.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Insert “Post Date” block into the “Table” block’ is closed to new replies.