• Resolved Jimmi

    (@jimmi61)


    Hi, I’m writing the code of a new theme and I wanted to decrease the indent space of the page list block.

    Searching the web did not helped, I give a try with the following code in theme.json:

    "core/page-list-item": {
    "style": {
    "indent": "1px"
    }

    But did not worked. May someone give me a hint?

    • This topic was modified 3 months, 1 week ago by Jimmi.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Hello @jimmi61
    It looks like you’re trying to adjust the indent space for the page list block in a WordPress theme using the theme.json file. However, the "indent" property doesn’t exist in the context of the theme.json configuration for the core/page-list-item block.

    To achieve this, you would typically need to add custom CSS to your theme. You can target the .wp-block-page-list__item class, which is used by the Page List block items, and adjust the padding or margin to change the indentation.

    Here’s how you can do it:

    1. Add Custom CSS in theme.json:You can use the styles section of the theme.json to add custom CSS. Here’s how you can modify the indent:
    {
    "styles": {
    "blocks": {
    "core/page-list-item": {
    "spacing": {
    "padding": "0 1rem"
    }
    }
    }
    }
    }

    If this doesn’t work as expected, you can use custom CSS directly in your style.css file.

    Add Custom CSS in style.css:

    In your theme’s style.css, you can add something like this:

    .wp-block-page-list__item {
    padding-left: 1rem; /* Adjust this value to change the indentation */
    }

    This CSS will decrease the indent space for the page list items.

    Thread Starter Jimmi

    (@jimmi61)

    hi @iflairwebtechnologies , thanks for your suggestions.

    Before changing the code I searched for block properties avaiable but I cannot find in the documentation, this is why I give a try following some example from other contexts. Do you know where I can find these details?

    I give a try to the example you sent me but neither of them gave any result, positive or negative.

    The first suggestion, add Custom CSS in theme.json, is exactly the same method I used, I inserted my code in style -> blocks sections, so I just replaced:

    "style": {
    "indent": "1px"

    with:

    "spacing": {
    "padding": "0 1rem"

    btw I believe “0 1” is a typo, I changed with 1, ans also 0 but there was not any change in the website.

    The second example did not changed anything too. May you direct me to documents that I may read to understand which properties are avaiable for the blocks?

    Thanks again for your patience.

    Thread Starter Jimmi

    (@jimmi61)

    Finally I found it! This code is working in theme.json:

    {
    "styles": {
    "css": " .wp-block-page-list ul { padding-left: 10px; } "
    }
    }

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.