EDITS.WS

Tag: gutenberg editor

  • How to Create a Custom WordPress Block (Easy Way)

    Do you want to create a custom WordPress block for your website?

    While WordPress comes with a lot of basic blocks for creating content, you might need something more specific for your website.

    In this article, we will show you two ways to create custom Gutenberg blocks for your WordPress site.

    How to create a custom Gutenberg block in WordPress

    Why Create a Custom WordPress Block?

    WordPress comes with an intuitive block editor that allows you to easily build your posts and pages by adding content and layout elements as blocks.

    By default, WordPress ships with several commonly-used blocks. WordPress plugins may also add their own blocks that you can use.

    However, sometimes you may want to create your own custom block to do something specific on your WordPress website because you can’t find a blocks plugin that works for you.

    With custom blocks, you can add unique features and functionality to your website that may not be available in pre-built blocks. This can help automate processes or make content creation for your WordPress blog more efficient.

    For example, you could create a custom block to display testimonials and then easily insert and manage that block without any coding knowledge.

    Having said that, let’s see how to easily create a completely custom block in WordPress.

    For this tutorial, we will be showing you two methods to create a custom block. You can use the quick links below to jump to the method of your choice:

    If you are a beginner and inexperienced with coding, then this method is for you.

    WPCode is the best WordPress code snippets plugin on the market that makes it super easy and safe to add custom code to your website.

    It comes with the block snippets feature that allows you to easily create custom blocks for your WordPress site without writing any code.

    First, you need to install and activate the WPCode plugin. For detailed instructions, you may want to see our beginner’s guide on how to install a WordPress plugin.

    Note: WPCode also offers a free version that you can use to add custom code to your website. However, you will need the Pro version of the plugin to unlock the custom block snippets feature.

    Upon activation, you need to head over to the Code Snippets » + Add Snippet page from the WordPress admin sidebar.

    Once you are there, click the ‘Use Snippet’ button under the ‘Add Your Custom Code (New Snippet)’ option.

    Add new snippet

    This will take you to the ‘Create Custom Snippet’ page, where you can start by typing a name for the custom block that you are about to create.

    Once you have done that, just select the ‘Blocks Snippet’ option from the ‘Code Type’ dropdown menu in the right corner of the screen.

    This will display the ‘Edit with Block Editor’ button in the ‘Code Preview’ box.

    Choose the Block Snippets option and click the Edit with block editor button

    Simply click on this button to launch the block editor.

    Now, a prompt will appear on your screen asking you to save the code snippet to load it in the block editor. Just click on the ‘Yes’ button to move ahead.

    Choose the Yes option in the Save Snippet prompt

    Now that you are in the block editor, you can easily create a custom block using the pre-made blocks available in the block menu.

    For this tutorial, we will be creating a custom block for adding testimonials on your site.

    First, you need to click the ‘+’ button in the top left corner of the screen to open up the block menu.

    From here, drag and drop the Heading block into the block editor interface and name it ‘Testimonials’.

    Add heading block for the testimonials block

    Next, you can use the paragraph, pull-quote, or quote blocks to add testimonials from different clients on your website.

    You can even use the image, site logo, social icons, or site tagline blocks to further customize your Testimonials block.

    Add testimonial quote in the custom block

    You can also customize the size, text color, or background color of your testimonials from the block panel on the right side of the screen.

    Once you are done, don’t forget to click the ‘Update’ button at the top to store your custom block settings.

    Next, just click on the ‘Return to WPCode Snippet’ button at the top to be redirected to the ‘Edit Snippet’ page.

    Click Return to WPCode snippet button at the top

    Once you are there, scroll down to the ‘Insertion’ section and choose the ‘Auto Insert’ mode.

    Upon activation of the code snippet, your custom block will be automatically added to where you choose to insert it on your website.

    Choose an insertion method

    Next, you have to configure the location of the custom block you created.

    To do this, simply click the ‘Location’ dropdown menu in the ‘Insertion’ section and switch to the ‘Page-Specific’ tab. From here, you can now choose the ‘Insert After Post’ option if you want to show your Testimonials block after the post ends.

    Once you do that, you can also configure the number of posts after which the testimonial block should appear. For example, if you type in the number 3, then the Testimonials block will appear in every third post.

    You can also display the block in between different paragraphs, after post excerpts, and more.

    Choose a block location

    However, if you don’t find the block location that you are looking for, then you can also create your own conditional logic rule to add the custom block to your preferred place.

    To do this, scroll down to the ‘Smart Conditional Logic’ section and toggle on the ‘Enable Logic’ switch.

    Next, you must click the ‘Add New Group’ button to start creating a conditional logic rule.

    Enable the conditional logic option

    For example, if you only want to show the custom block you created on a specific page or post, then you will have to select the ‘Page URL’ option from the dropdown menu on the right.

    After that, you can leave the dropdown menu in the middle as it is and then add the URL of the WordPress page/post of your choice into the field on the left.

    You can also configure your conditional logic rule to only display the custom block on a specific page, logged-in users, on WooCommerce store pages, Easy Digital Downloads pages, specific dates, and more.

    Add conditional logic rule

    Once you are done, scroll back to the top of the page and toggle the ‘Inactive’ switch to ‘Active’. Then, click the ‘Update’ button to store your settings.

    Your custom block will now be automatically added to all the locations that you selected for the block snippet.

    Activate custom block

    Keep in mind that the custom block you created won’t be displayed as an option in the block menu of the Gutenberg editor.

    You will have to configure the block settings by visiting the Code Snippets page from the WordPress dashboard and clicking the ‘Edit’ link under the block snippet.

    This will open the ‘Edit Snippet’ page, where you can customize the block or change its location and conditional logic rules easily.

    Edit block snippet

    Now visit your website to view the custom block that you created in action.

    Here is our custom Testimonials block on our demo website.

    Testimonials block preview

    Method 2: Create Custom Blocks for WordPress Using Genesis Custom Code Plugin (Free)

    If you are an intermediate user and looking for a free solution, then this method is for you. Keep in mind that you will need to be familiar with HTML and CSS to follow the instructions in this method.

    First, you need to install and activate the Genesis Custom Blocks plugin. For more details, see our step-by-step guide on how to install a WordPress plugin.

    Made by the people behind WP Engine hosting, this plugin provides developers with easy tools to quickly create custom blocks for their projects.

    For the sake of this tutorial, we will build a Testimonials block.

    Step 1: Create a Custom Block for WordPress

    First, you need to head over to Custom Blocks » Add New page from the left sidebar of your admin panel.

    Creating a new custom block

    This will bring you to the Block Editor page, where you will be creating a custom block for your WordPress site.

    From here, you can start by giving a name to your block.

    Block name

    Now on the right side of the page, you will find the block properties that you can configure.

    Here you can choose an icon for your block, add a category, and add keywords.

    Configure block settings

    The slug will be auto-filled based on your block’s name, so you don’t have to change it. However, you may write up to 3 keywords in the ‘Keywords’ text field so that your block can be easily found.

    Now, it’s time for you to add some fields to your block. You can add different types of fields like text, numbers, email addresses, URLs, colors, images, checkboxes, radio buttons, and more.

    We will add 3 fields to our custom Testimonials block: an image field for the photo of the reviewer, a textbox for the reviewer name, and a text area field for the testimonial text.

    Just click on the ‘+’ button to insert the first field.

    Add block field

    This will open up some options for the field in the right column. Let’s take a look at each of them.

    • Field Label: You can use any name of your choice for the field label. Let’s name our first field ‘Reviewer Image’.
    • Field Name: The field name will be generated automatically based on the field label. We will use this field name in the next step, so make sure it’s unique for every field.
    • Field Type: Here, you can select the type of field. We want our first field to be an image, so we will pick ‘Image’ from the dropdown menu.
    • Field Location: You can decide whether you want to add the field to the editor or the inspector.
    • Help Text: You can add some text to describe the field. This is not required if you are creating this block for your personal use but may be helpful for multi-author blogs.

    You may also see some additional options based on the field type you choose. For example, if you select a text field, then you will get extra options like placeholder text and character limit.

    Following the above process, let’s add 2 other fields for our Testimonials block by clicking the ‘+’ button.

    In case you want to reorder the fields, then you can do that by dragging them using the handle on the left side of each field label. To edit or delete a particular field, you need to click the field label and edit the options in the right column.

    Publish block

    Once you are done, just click on the ‘Publish’ button on the right side of the page to save your custom Gutenberg block.

    Step 2: Create a Custom Block Template

    Although you created the custom WordPress block in the last step, it won’t work until you create a block template.

    The block template determines exactly how the information entered into the block is displayed on your website. You get to decide how it looks by using HTML and CSS, or even PHP code if you need to run functions or do other advanced things with the data.

    There are two ways to create a block template. If your block output is in HTML/CSS, then you can use the built-in template editor.

    On the other hand, if your block output requires some PHP to run in the background, then you will need to manually create a block template file and upload it to your theme folder.

    Method 1: Using Built-in Template Editor

    On the custom block edit screen, simply switch to the ‘Template Editor’ tab and enter your HTML under the markup tab.

    Block template editor

    You can write your HTML and use double curly brackets to insert block field values.

    For instance, we used the following HTML for the sample block we created above:

    <div class="testimonial-item">
    <img src="{{reviewer-image}}" class="reviewer-image">
    <h4 class="reviewer-name">{{reviewer-name}}</h4>
    <div class="testimonial-text">{{testimonial-text}}</div>
    </div>
    

    After that, just switch to the ‘CSS’ tab to style your block output markup.

    Enter your block template CSS

    Here is the sample CSS we used for our custom block:

    .reviewer-name { 
        font-size:14px;
        font-weight:bold;
        text-transform:uppercase;
    }
    
    .reviewer-image {
        float: left;
        padding: 0px;
        border: 5px solid #eee;
        max-width: 100px;
        max-height: 100px;
        border-radius: 50%;
        margin: 10px;
    }
    
    .testimonial-text {
        font-size:14px;
    }
    
    .testimonial-item { 
     margin:10px;
     border-bottom:1px solid #eee;
     padding:10px;
    }
    

    Method 2: Manually Uploading Custom Block Templates

    This method is recommended if you need to use PHP to interact with your custom block fields. You will basically need to upload the editor template directly to your theme.

    First, you need to create a folder on your computer and name it using your custom block name slug.

    For instance, our demo block is called Testimonials, so we will create a testimonials folder.

    Block template folder

    Next, you need to create a file called block.php using a plain text editor. This is where you will put the HTML / PHP part of your block template.

    Here is the sample template we used for our example:

    <div class="testimonial-item <?php block_field('className'); ?>">
    <img class="reviewer-image" src="<?php block_field( 'reviewer-image' ); ?>" alt="<?php block_field( 'reviewer-name' ); ?>" />
    <h4 class="reviewer-name"><?php block_field( 'reviewer-name' ); ?></h4>
    <div class="testimonial-text"><?php block_field( 'testimonial-text' ); ?></div>
    </div>
    

    Now you may have noticed how we used the block_field() function to fetch data from a block field.

    We have wrapped our block fields in the HTML we want to use to display the block. We have also added CSS classes so that we can style the block properly.

    Don’t forget to save the file inside the folder you created earlier.

    Next, you need to create another file using the plain text editor on your computer and save it as block.css inside the folder you created.

    We will use this file to add CSS needed to style our block display. Here is the sample CSS we used for this example:

    .reviewer-name { 
        font-size:14px;
        font-weight:bold;
        text-transform:uppercase;
    }
    
    .reviewer-image {
        float: left;
        padding: 0px;
        border: 5px solid #eee;
        max-width: 100px;
        max-height: 100px;
        border-radius: 50%;
        margin: 10px;
    }
    
    .testimonial-text {
        font-size:14px;
    }
    
    .testimonial-item { 
     margin:10px;
     border-bottom:1px solid #eee;
     padding:10px;
    }
    

    Don’t forget to save your changes.

    Your block template folder will now have two template files inside it.

    block template files

    After that, you need to upload your block folder to your website using an FTP client or the File Manager app inside your WordPress hosting account’s control panel.

    Once connected, navigate to the /wp-content/themes/your-current-theme/ folder.

    Create blocks folder inside your WordPress theme folder

    If your theme folder doesn’t have a folder named ‘blocks’, then go ahead and create a new directory and call it blocks.

    Next, you have to upload the folder you created on your computer to the blocks folder.

    Uploaad block template files

    That’s all! You have successfully created manual template files for your custom block.

    Step 3: Preview Your Custom Block

    Before you can preview your HTML/CSS, you will need to provide some test data that can be used to display a sample output.

    Inside the WordPress admin area, edit your block and switch to the ‘Editor Preview’ tab. Here, you need to enter some dummy data.

    Editor preview

    This data won’t be a part of your custom block and will only be used for previewing the changes you made using HTML and CSS.

    Once you have added the data, don’t forget to click on the ‘Update’ button to save your changes.

    Save your template changes

    If you don’t click the ‘Update’ button, then you won’t be able to see the preview of your custom block.

    You can now switch to the ‘Front-end Preview’ tab to see how your block will look on the front end of your WordPress website.

    Front-end preview of your website

    If everything looks good to you, then you can update your block again to save any unsaved changes.

    Step 4: Using Your Custom Block in WordPress

    You can now use your custom block in WordPress like you would any other block.

    Simply edit any post or page where you want to use this block. Then, click the ‘+’ button in the top left corner to open up the block menu.

    Inseting custom block in posts and pages

    From here, find your block by typing in its name or keywords and then add it to the page/post.

    After you insert the custom block into the content area, you will see the block fields you created earlier.

    Block fields preview

    You can fill out the block fields as needed.

    As you move away from the custom WordPress block to another one, the editor will automatically show a live preview of your block.

    Block preview inside the block editor

    You can now save your post and page and preview it to see your custom block in action on your website.

    Here’s how the Testimonials block looks on our test site.

    Custom block live preview

    We hope this article helped you learn how to easily create custom Gutenberg blocks for your WordPress website. You may also want to see our guide on how to create a custom WordPress theme from scratch or see our expert picks for the best block themes for full site editing.

    If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

    The post How to Create a Custom WordPress Block (Easy Way) first appeared on WPBeginner.

  • How to Select and Use Nested Blocks in WordPress

    Do you want to learn how to select and use nested blocks in WordPress?

    The WordPress Gutenberg nested blocks feature allows you to add multiple blocks within a parent block. Then, you can customize different block elements at the same time, organize post content efficiently, and access more design flexibility.

    In this article, we will show you how to easily select and use WordPress nested blocks.

    Select and use nested blocks in WordPress

    What Are WordPress Nested Blocks?

    The WordPress Gutenberg nested block feature allows you to insert (or ‘nest’) one or more blocks within another block.

    Nested blocks help you create more complex layouts on your WordPress website by adding multiple blocks inside each other. This allows for more flexibility when designing and formatting content for pages and posts.

    For instance, you can nest multiple Image blocks within a Group block to display a set of photos from a particular event or a series of artworks created using a particular technique.

    Preview of WordPress nested blocks

    Moreover, the nested block feature allows you to edit individual blocks separately. This means that you can customize each block according to your needs without affecting the other blocks. In turn, this results in better content organization, makes your content more attractive, and streamlines your content creation process.

    That being said, let’s see how you can easily select and use WordPress Gutenberg nested blocks.

    How to Use WordPress Nested Blocks

    You can easily nest multiple blocks together using the Group or Columns block in the Gutenberg block editor.

    First, you need to open up an existing or new post in the block editor from the WordPress admin sidebar.

    From here, simply click on the ‘+’ button in the top left corner of the screen and find the ‘Group’ block. Upon clicking it and adding it to the page, you will need to select a layout for the blocks that you will nest together.

    For this tutorial, we will be selecting the ‘Group’ layout.

    Select Group block from the block menu

    Next, simply click on the ‘+’ button on the screen to start adding content within the parent block.

    For the sake of this tutorial, we will be adding an Image block.

    Add an image block within the Group block

    Upon adding the Image block, just click the ‘Group’ button in the block toolbar at the top to select the parent block.

    Next, you need to click the ‘+’ button to open up the block menu, from where you can choose other blocks to add.

    Open the block menu to add another block within the Group block

    How to Configure WordPress Nested Block Settings

    Once you have nested multiple blocks, you can configure their individual settings by clicking on each block. This will open up the block settings in the right column on the screen.

    From here, you can adjust the background color, text color, and size of the individual blocks without affecting the other blocks that are nested within it.

    Configure the individual block settings

    To configure the settings of all the nested blocks together, you will have to click the ‘Group’ button in the block toolbar at the top. This will open up the parent block settings in the right column.

    You can now configure the justification, orientation, background color, text color, and typography of all the nested blocks.

    Keep in mind that these settings will affect all the blocks nested within the parent block.

    Configure the settings of the Group block

    You can also convert an existing individual block into nested blocks by clicking the ‘Options’ button in the top toolbar of any block.

    This will open up a menu prompt, where you need to select the ‘Create Reusable block’ option.

    Choose the Create Reusable Block option

    Once you have done that, a new reusable block will be created where you can add multiple blocks.

    After you are done, don’t forget to click the ‘Publish’ or ‘Update’ button to save your changes.

    Create nested blocks

    In our example, we have nested a Title, Image, and Paragraph block within a Group block. This is how the nested blocks looked on our demo website.

    Preview of WordPress nested blocks

    Bonus: Use the Wayfinder Plugin to Easily Select Nested Blocks

    Sometimes, it can be difficult to select an individual block and configure it when there are multiple blocks nested together.

    Luckily, the Wayfinder plugin makes it super easy to select nested blocks from a parent block and even tells you the type and class of the blocks.

    First, you will need to install and activate the Wayfinder plugin. For more instructions, you may want to see our guide on how to install a WordPress plugin.

    Upon activation, head over to the Settings » Wayfinder page from the WordPress admin sidebar.

    Once you are there, all the settings will already be activated. You simply need to uncheck the box next to the settings that you don’t want to use.

    For example, if you want Wayfinder to display block types for all the blocks in the editor, then keep the box checked next to the ‘Display block type’ option.

    Configure the Wayfinder plugin settings

    However, if you don’t want the plugin to display block classes, simply uncheck the box next to that option.

    After configuring the settings, don’t forget to click the ‘Save Changes’ button.

    Next, you need to open up an existing or new post from the WordPress admin sidebar.

    Once you are there, hovering your mouse over any block will show an outline with its name. You will also be able to see the outline and name of any nested blocks within the parent block.

    GIF for the Wayfinder plugin

    This will help you identify all the different blocks that are nested within a Group or Columns block.

    From here, you can easily select an individual block from the parent block to configure its settings.

    Use Wayfinder plugin to easily select a block

    You can also select all the nested blocks at the same time by simply clicking on the ‘Columns’ or ‘Group’ heading. This will open up the parent block settings in the right column.

    Once you have configured the block settings, simply click the ‘Update’ or ‘Publish’ button to save your changes.

    Click the Group block outline to open its settings

    We hope this article helped you learn how to select and use WordPress nested blocks. You may also want to see our tutorial on how to change block height and width in WordPress and our top picks for the must-have WordPress plugins to help grow your site.

    If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

    The post How to Select and Use Nested Blocks in WordPress first appeared on WPBeginner.

  • How to Change Block Height and Width in WordPress

    Do you want to change block height and width in WordPress?

    By default, WordPress makes it easy to create beautiful content layouts for your posts and pages using blocks. However, sometimes you may want to resize blocks to make them look better.

    In this article, we will show you how to easily change block height and width in WordPress.

    How to change block height and width in WordPress

    Why Change Block Height and Width in WordPress?

    The block editor enables you to add content to your WordPress website using different blocks, including headings, paragraphs, images, videos, audio, and more.

    However, sometimes you may want to change the width or height of a specific block to improve its appearance or the layout of the overall content.

    Adjusting block sizes can also ensure that your content is responsive and displays properly on all devices, including phones, tablets, and laptops.

    For example, you may have uploaded an image in the content editor, but it is too large and makes the page look unappealing.

    Preview of an image

    Or, you might want to change the size of the heading block to align it better with the content.

    By adjusting the width and height of the blocks, you can make your posts and pages look more aesthetically pleasing.

    That being said, let’s see how you can easily change block height and width in WordPress.

    Method 1: Change the Block Height and Width Using Block Settings

    For this method, we will show you how to change a block’s height and width using the default settings offered by WordPress.

    Currently, WordPress does not offer the same resizing options for all of the blocks. However, the block editor provides many ways to resize the height and width of different blocks.

    Let’s start with the Image block in WordPress.

    First, you can change the alignment of the Image block by clicking on the ‘Align’ button in the toolbar above the block.

    Here, choosing the ‘Wide Width’ option will make the block the same width as the container.

    Or, the ‘Full Width’ alignment option will make the block the entire width of the page.

    Use alignment settings to resize an image

    You can also resize a block by going to the ‘Block Settings’ panel on the right and scrolling down to the ‘Settings’ section. From here, you can resize a block from the ‘Image Size’ dropdown menu.

    You can also adjust the block’s width and height by typing the preferred pixel size into the ‘Width’ and ‘Height’ boxes in the ‘Image dimensions’ section.

    Below that, you can also adjust the block’s size by percentage.

    Resize an image using block panel settings

    Another way to resize an Image block is by clicking on the image itself to bring up a blue border with circular anchors.

    Then, simply drag these anchors to change the height and width of the image block.

    Resize Image block using anchors

    Once you are done, click on the ‘Update’ or ‘Publish’ button to store your settings.

    Method 2: Change the Block Height and Width Using the Columns Block

    If the block you want to resize does not come with alignment buttons or resize settings, then this method is for you.

    For this method, we will place our block inside the Columns block. It acts as a container where you can add blocks in each column. Then, you can resize those blocks by adjusting the height and width of the columns.

    First, you will need to click on the ‘Add Block’ (+) button in the top left corner of the screen.

    From here, simply locate and add the Columns block to the content editor. Then, you will be asked to choose a variation.

    Choose the column block

    After that, the column layout will be displayed on the screen, and you can now add the block you want by clicking on the ‘Add Block (+)’ button inside a column.

    Once the block has been added, you can resize it by using the ‘Column settings’ located in the right panel.

    Add Block using column

    Once you are done, simply click the ‘Publish’ button to store your changes.

    This is how the content looked on our demo website after resizing and aligning two paragraph blocks inside a two-column block.

    Column block preview

    Method 3: Change the Block Height and Width Using the Group Block

    You can also adjust the width and height of blocks using the Group block. It allows you to group different blocks and style them together.

    First, you will need to click on the ‘Add Block’ (+) button at the top. Next, you must locate and add the Group block to the content editor.

    Once you do that, the Group block will display three different layout options that you can choose from. For this tutorial, we will use the ‘Group’ layout.

    Choose the Group block and select a layout

    After that, the ‘Add Block’ button will be displayed on the screen. You can now add any block you want.

    In this tutorial, we will be adding and resizing a Heading block, a Paragraph block, and an Image block.

    Add a heading block to the Group block

    To add multiple blocks to the Group, you must click on the ‘Select Group’ button from the block toolbar.

    Once the Group is selected, simply click on the ‘Add Block’ button (+) at the bottom.

    Add multiple blocks in Group

    Clicking on the ‘Select Group’ button also opens up the block settings in the right column. From here, you can easily adjust the layout, justification, and orientation of all the blocks.

    Changing the layout will also change the different block sizes. You can configure these settings until you are happy with the result.

    Configure the block settings of the Group block

    Once you are done, click on the ‘Update’ or ‘Publish’ button to store your settings.

    This is how the Group block looked on our demo website.

    Group block preview

    Method 4: Change the Block Height Using the Cover Block

    This resizing method is for you if you want to use the Cover block. It enables you to display text and other content on top of an image or video.

    First, you will need to click on the ‘Add Block’ (+) button at the top and find the Cover block.

    Once you have done that, you will be asked to choose a color or upload an image from the WordPress media library. This image or color will be used as the background for the Cover block.

    Add the Cover block

    Next, simply drag and drop any block you want into the Cover block.

    After that, you need to click on the Cover block to open up its block settings in the right column.

    From here, scroll down to the ‘Dimensions’ panel, where you can adjust the height of the Cover block using pixels.

    Change the Cover block height

    Finally, don’t forget to click on the ‘Save Changes’ button to store your settings.

    For more detailed instructions on how to use the Cover block, you may want to see our beginner’s guide on Cover Image vs. Featured Image in the WordPress block editor.

    Bonus: Create Beautiful Pages Using Advanced Blocks in SeedProd

    You can easily create beautiful and aesthetically-pleasing pages using the SeedProd plugin.

    It is the best WordPress page builder on the market that allows you to create landing pages using blocks. These blocks are also super easy to customize and resize according to your needs.

    First, you will need to install and activate the SeedProd plugin. For more details, you can read our guide on how to install a WordPress plugin.

    Note: SeedProd also offers a free version, but we will be using the premium version for this tutorial.

    Upon activation, you must go to the SeedProd » Settings page from your WordPress dashboard and enter the license key in the ‘License Key’ box.

    You can find the license key on your account page on the SeedProd website.

    Paste license key in the field

    Next, you need to visit the SeedProd » Landing Pages screen from the admin sidebar to start creating a landing page.

    From here, just click on the ‘Add New Landing Page’ button.

    Click the Add New Landing Page button

    You will now be taken to the ‘Choose a New Page Template’ page. SeedProd offers many pre-made templates that you can pick from.

    After you have selected a template, you will be asked to provide a name and URL for your landing page.

    Upon adding these details, simply click on the ‘Save and Start Editing the Page’ button to continue.

    Enter your page details

    This will launch SeedProd’s drag-and-drop page builder, where you can now start editing your page.

    For more detailed instructions, please see our guide on how to create a landing page with WordPress.

    For this tutorial, we will be adding and resizing an Image block and a Button block.

    First, you will need to drag the Image block from the block panel on the left and drop it anywhere you like on the page.

    Choose the image block in the SeedProd

    Next, simply click on the Image block to open its block settings in the left column. From here, you can upload an image from your media library.

    Next, you can change the block’s height and width using pixels or percentages.

    Change the block size in SeedProd

    You can also adjust the image size and position by switching to the ‘Advanced’ tab at the top of the settings panel.

    Then, just click on the Spacing panel to expand its settings.

    Visit the Spacing panel by switching to the Advanced tab

    Here, simply add values to adjust the block’s margin and padding according to your needs.

    You can adjust the margin and padding for the top, bottom, left, and right areas of the block.

    Ajust the margin and padding of the block

    With Seedprod, you can also add a Spacer block between two different blocks to put some space between them.

    First, you will need to locate and add the ‘Spacer’ block from the left column. Then, click on it to open its settings.

    Add the Spacer block

    Now, you can control the height of the spacer using the ‘Height’ slider.

    The spacer block can help you create a clutter-free website.

    Use the height slider to adjust Spacer block

    You can also change the width and height of other blocks in the same way, including the Video, Heading, and Button blocks.

    Simply find the Button block in the left column and drag it onto your page.

    Add the Button block to the website

    Next, you will need to click on the Button to open up its block settings.

    From here, switch to the ‘Advanced’ tab from the top. You can change the height of the block by dragging the ‘Vertical Padding’ slider.

    Changing height of the button block

    To change the width, drag the ‘Horizontal Padding’ slider in the left column.

    Once you are done, don’t forget to click on the ‘Save’ button.

    Change width of the button block

    We hope this article helped you learn how to change block width and height in WordPress. You may also want to see our article on how to add and align images in the WordPress block editor and our top picks for the must-have WordPress plugins to grow your site.

    If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

    The post How to Change Block Height and Width in WordPress first appeared on WPBeginner.

  • How to Bulk Convert Classic Blocks to Gutenberg in WordPress

    Do you want to bulk convert your old content using classic blocks into the Gutenberg (block) format in WordPress?

    After updating to any version above WordPress 5.0, your older post and page content will show up inside a Classic block in the new WordPress content editor. If you have dozens or hundreds of posts, then converting that Classic block content into individual blocks can take a lot of time. Thankfully, there is a bulk convert option.

    In this article, we will show how to easily bulk convert classic blocks into Gutenberg blocks in WordPress.

    How to bulk convert classic blocks to Gutenberg in WordPress

    Why Convert Classic Block Into Individual Blocks in WordPress?

    If you have had a WordPress blog for a long time, then chances are that some of your posts were written using the older classic editor.

    This older content will now appear inside the Classic block in the post editor.

    Classic block preview

    By converting the classic block into individual Gutenberg blocks, you will gain more control and flexibility over your content.

    You can easily edit your post by working with individual blocks. You will also be able to take advantage of the customization options available for each block.

    Block editor features

    This helps you easily edit the content within the block editor while allowing you to create beautiful content layouts for your posts and pages.

    Note: In most cases, switching from the classic to the block editor will not affect your posts on the front end.

    That being said, let’s see how to easily bulk-convert classic blocks to Gutenberg in WordPress.

    Method 1: Convert Classic Block to Gutenberg Using Default Settings

    If you want to convert a single post or page from the Classic block into individual blocks, then this method is for you.

    First, you need to edit the post and page where you want to convert the blocks. You can do this by heading to Posts » All Posts in your WordPress dashboard and then clicking on ‘Edit (block editor)’ under the post.

    This will open your post in the block editor. Then, click on the ‘Convert to blocks’ button in the toolbar at the top of the Classic block.

    Click the Convert to block button

    The Classic block will now be converted into individual Gutenberg blocks.

    You can now access all the block settings for individual blocks from the right column. If you cannot see this panel, then click on the gear icon at the top right of the editor.

    Access block settings

    Once you are done, don’t forget to click the ‘Update’ button to save your changes.

    Method 2: Bulk Convert Classic Block into Gutenberg Blocks

    If you want to easily convert the Classic block into Gutenberg blocks for all the posts and pages immediately, then this method is for you.

    Important: Make sure to create a complete WordPress backup of your site before using this method because you cannot undo the conversion once it’s completed.

    First, you need to install and activate the Convert to Blocks plugin. For more instructions, please see our guide on how to install a WordPress plugin.

    The plugin works out of the box and automatically bulk-converts any Classic blocks into Gutenberg blocks once it’s been activated.

    All you need to do is simply edit a post or page that was written using the classic editor.

    You will now notice that the Classic block has been converted into individual blocks.

    Use a plugin to convert classic block into Gutenberg blocks

    Remember that the conversion will not affect the layout of your posts on the front end, so the posts will look the same on your website.

    This is how the same post looked on our demo site after converting it from Classic to individual blocks.

    Preiveiw of a post

    We hope this article helped you learn how to bulk convert classic blocks into Gutenberg blocks in WordPress. You may also want to see our beginners’ guide on WordPress SEO, and our top picks for the best contact form plugins.

    If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

    The post How to Bulk Convert Classic Blocks to Gutenberg in WordPress first appeared on WPBeginner.

  • 13 Common WordPress Block Editor Problems and How to Fix Them

    Are you running into errors when using the WordPress block editor?

    WordPress replaced the old classic editor in 2019 with a brand new content editor called Gutenberg. This new editor uses blocks to create content in WordPress. However, sometimes you may come across annoying issues when using it.

    In this article, we’ll share how to fix the most common WordPress block editor problems, so you can improve your workflow.

    Common block editor issues and how to fix it

    What is WordPress Block Editor?

    WordPress block editor, or Gutenberg, is a new content editor introduced in the WordPress 5.0 release. Since then, WordPress has improved the editor and added new features and functionalities.

    It provides more customization features compared to the Classic Editor. You get different blocks to add different elements to your content and don’t have to edit code to change the appearance and style.

    It tries to show how your blogs and pages will look in real time by mimicking the same font and colors of your WordPress theme.

    For example, you can use an image block to add pictures to your blog posts. Plus, you get options like image style, size, alignment, and more using the block.

    Add an Image Block

    Besides that, many WordPress plugins add their blocks to the content editor. This makes it super easy to embed things like forms, social media feeds, and tables of content in just a few clicks.

    That said, the block editor isn’t perfect. Like any other WordPress plugin, you may come across different errors or bugs. Here are a few common issues in the content editor. You can click the links below to see your preferred section.

    1. Fix WordPress Block Editor Not Working Error

    One of the most common issues users face is the ‘WordPress block editor not working.’

    There are multiple reasons why this error occurs. For instance, it could be because of an old outdated theme, a faulty plugin, or other technical errors.

    The WordPress block editor may also not work if you have a misconfigured setting on your site, like disabling the visual editor when creating a user profile.

    You can check this by going to Users » Profile from your WordPress dashboard. From here, just ensure that the ‘Disable the visual editor when writing’ option is not selected.

    Disable the visual editor when writing

    If the problem still persists, then you can try deactivating all the plugins on your site. This should help rule out any conflicts a plugin might be causing and stop the block editor from working.

    Another way to fix this is by updating your WordPress theme. An outdated theme can cause the block editor not working error. You can see our guide on how to update WordPress theme without losing data and customization.

    2. WordPress Block Editor Keeps Crashing

    Another common issue that some users face is the WordPress block editor would crash unexpectedly.

    When it crashes, you would see a ‘The editor has encountered an unexpected error’ error message. WordPress would then show 3 options, including attempt recovery, copy post text, and copy error.

    Block editor crashed

    There could be multiple reasons for this issue. For instance, a plugin could break the block editor and show this error, or your WordPress version isn’t up to date.

    You can fix this by deactivating all the plugins and reactivating them one by one. Another fix is to change your WordPress to a default theme, like Twenty Twenty-Two, and see if the problem persists.

    If you’re still facing this issue after checking the WordPress plugins and theme, then try updating the WordPress version and clearing the WordPress cache.

    3. Remove The Invalid JSON Error in the Content Editor

    When you’re editing a blog post or page, a ‘The response is not a valid JSON response’ error may occur when you click the Update button in the block editor.

    View JSON error in block editor

    WordPress is in continuous communication with the website server in the background when you’re editing a post on your WordPress blog. This error is caused when WordPress fails to receive a response from the server or the response is not in the JSON format.

    Here are a few reasons why you would get an invalid JSON error and how to fix them:

    • Check WordPress URLs in Settings – You will need to ensure that the WordPress Address and Site Address in your site’s settings are correct. Simply go to the Settings » General page and check if the URLs are the same. The JSON error could be triggered if the Site Address is different.
    Ensure WordPress and site address are same
    • Fix Permalink Settings in WordPress – In WordPress, you can set up SEO-friendly URLs for your pages and posts. However, incorrect settings can make it hard for the block editor to get a valid JSON response. Just make sure to select the right permalink format.
    • Check WordPress .htaccess File Settings – The .htaccess file is used as a configuration file in WordPress to manage SEO-friendly URLs (permalinks). Usually, WordPress will automatically regenerate and update it. However, incorrect settings or out-of-date .htaccess files can cause JSON errors.
    • See REST API Debug Logs – The REST API is a set of techniques WordPress uses to communicate with your site’s server. A JSON error can also mean that REST API encountered an error. You can check this by viewing the REST API logs on the Site Health page in WordPress.
    • Try Deactivating All The Plugins – A conflict between different WordPress plugins can also result in an invalid JSON error. Try deactivating all the plugins on your website and see if the error reoccurs.
    • Switch to the Classic Editor – If you’re still unable to resolve the JSON error, then you can switch back to the Classic Editor in WordPress. The old content editor doesn’t rely on REST API to get a JSON response from the website server.

    To learn more about each of these tips in detail, please see our guide on how to fix the invalid JSON error in WordPress.

    4. Resolve Updating Failed / Publishing Failed Error

    Another error you might see when updating or publishing a blog post or page in the WordPress block editor is: ‘Updating failed. You are probably offline.’

    This issue occurs when WordPress REST API cannot communicate with the WordPress database.

    Updating failed error

    If the block editor fails to send and receive requests from the WordPress hosting database, then different parts of your site won’t function. This includes the block editor.

    The REST API may stop working if you’re not connected to the internet or have lost connectivity. To fix this issue, please make sure that your internet connection is working properly, and then try to update or publish your page.

    Aside from that, you can go to Tools » Site Health from your WordPress dashboard and view the REST API logs. If there is an issue with REST API, then you will see it under the ‘recommended improvements’ section.

    View site health

    The error log will show what happened to the REST API and may give you clues about what might have caused the issue.

    For information on fixing this issue, you can take a look at our guide on how to fix WordPress updating failed errors.

    5. Add or Remove Blank Spaces between WordPress Blocks

    When creating custom pages and posts using the WordPress block editor, you may notice too much or too little space between blocks.

    Usually the spacing is controlled by your WordPress theme. However, there are options in the block editor that also let you control the layout of your page and offer a better user experience.

    For instance, you can add a Spacer block to add blank spaces. Simply click the ‘+’ button and add the Spacer block anywhere in the content.

    Add spacer block to page

    This way, you can add additional space between blocks.

    WordPress also lets you adjust the size of the spacer block. You can make it bigger or smaller by dragging the block up or down.

    Resize spacer block

    If you want to remove extra blank space between blocks, then you will need to enter custom CSS into your WordPress theme or use a CSS plugin like CSS Hero.

    The plugin lets you edit your website’s CSS without editing the code. It offers different spacing options that you can use to adjust the blank space between blocks.

    CSS Hero change bottom margin

    You can also use SeedProd to create a custom page in WordPress and have full control over the design.

    To learn more, please see our guide on how to add or remove blank space between WordPress blocks.

    6. Copy and Paste Content without Formatting Issues

    Have you ever noticed that when you copy and paste content from a desktop app or a web page into the block editor, you end up pasting unwanted formatting as well?

    You’ll see that the font and colors of the pasted content don’t match your WordPress theme. This is very common if you’re using Microsoft Word or Google Docs to write the content and then enter it in the block editor.

    Some simple tips for keeping the original formatting include using Word and Google Docs heading styles. This way, WordPress automatically picks the headline level when you paste the content into the block editor.

    Besides that, you should check the HTML code of your page or post after pasting the content. In the WordPress content editor, you can select a block and then click the 3 vertical dots option. From the dropdown menu, simply select the ‘Edit as HTML’ option.

    Switching to the HTML View of a Block in the WordPress Block Editor

    This way, you should be able to find any formatting errors, like incorrect bolds and italics, unwanted text, and more.

    For more details, you can see our guide on how to copy and paste in WordPress without formatting issues.

    7. Fix the Image Upload Issue in WordPress

    Next, you might see an error when uploading images in the WordPress block editor. It is one of the most common image issues in WordPress.

    The main reason for this error is due to incorrect file permissions. All your website files are stored on your web hosting service and require specific file and directory permissions to work.

    If these permissions are incorrect, it can prevent WordPress from reading and uploading files onto the hosting server. As a result, you will notice that images will disappear from the media library when uploaded, or you may see an error that says:

    ‘Unable to create directory wp-content/uploads/2019/04. Is its parent directory writable by the server?’

    To fix this issue, you’ll need to edit the file permissions. You can use an FTP client and access the /wp-content/ folder. From here, you can right-click the folder and change the file permissions.

    Check the File Permissions of the WP-Content Folder

    Follow our step-by-step guide on how to fix image upload issue in WordPress for more information on this fix.

    8. Fixing the HTTP Image Upload Error

    Another issue you may encounter when uploading images in the WordPress block editor is the HTTP error.

    WordPress will show a generic ‘HTTP’ error’ when you upload images in the Media Library and you won’t be able to see a preview of the picture.

    HTTP image upload error

    There are several things that could cause this issue. The frustrating part is that the error message doesn’t give many clues to the actual cause.

    To fix this, you can try a bunch of things. First, you can simply wait a few minutes and try reuploading the image. At times, your website server could encounter a problem like unusual traffic and low server resources.

    Besides that, you can increase WordPress memory limit and prevent lack of memory from causing the HTTP error. Other things you can try include changing the image editor library used by WordPress and editing the .htaccess file.

    Also, your login might have expired, and this error will sometimes go away by going to your login screen and entering your username and password again.

    You can read about each of these tips in detail in our guide on how to fix the HTTP image upload error in WordPress.

    9. Remove Missed Schedule Post Errors in WordPress

    Did you know that WordPress offers a built-in option to schedule blog posts?

    In the WordPress content editor, you can change the date and time for publishing your blog posts. However, sometimes your scheduled content may not get published at the set time.

    Posts Can Be Published Immediately or Scheduled to Go Live in the Future

    The main reason for this error is due to the WordPress hosting environment or plugin conflicts. WordPress uses a technology called ‘cron’ to automatically publish your post at a later time.

    If a plugin or the website hosting server is affecting the cron jobs, then it will lead to missed schedule post error in WordPress.

    You can fix this issue by checking the timezone of your WordPress site. It is possible that your site’s timezone doesn’t match the timezone you’d like to use for scheduling your blogs.

    Simply head to Settings » General from the WordPress admin panel and scroll down to the Timezone section.

    Edit the timezone settings

    You can also try to fix this issue by clearing the WordPress cache and increasing the WordPress memory limit.

    Please see our guide on how to fix the missed scheduled post error in WordPress.

    10. Fixing Alignment Issues in WordPress Block Editor

    Another common WordPress block editor you might face is that your content and images may not be properly aligned.

    For example, let’s say you added a bullet list to a blog post and center-aligned it. However, the list appears left-aligned in the block editor when editing the post. Similarly, a center-aligned image block may appear aligned to the left or right.

    If you have the Gutenberg plugin installed and active on your WordPress site, then it can cause block alignment issues. We recommend that you deactivate the Gutenberg plugin and see if it resolves the problem.

    Another solution is to add the following custom CSS code for the text you’d like to center-align:

    .has-text-align-center {
    text-align: center;
    }
    

    You can also see our guide on how to add and align images in the WordPress block editor.

    11. Resolve Facebook Incorrect Thumbnail Issue

    Have you ever noticed that when you share an article on Facebook, the post thumbnails are incorrect?

    The problem can be caused by conflicting plugins, content delivery network (CDN) issues, or missing open graph meta tags for Facebook.

    Now, this isn’t an issue that you will see in the WordPress block editor. However, you can specify an open graph image for Facebook using the content editor.

    You can use the All in One SEO (AIOSEO) plugin to quickly fix the issue. It is the best SEO plugin for WordPress and helps you optimize your site for search engines and social media.

    Upon activation, you will see an AIOSEO Settings meta box in the WordPress content editor. Simply head to the ‘Social’ tab.

    head to the social tab

    Next, you can scroll down to the ‘Image Source’ section.

    From the dropdown, you can select which image to show on Facebook and other social media sites when the article is shared.

    Select image source

    You can follow our guide on how to fix Facebook incorrect thumbnail issue in WordPress and learn about other ways of resolving this issue.

    12. Fixing Facebook and Instagram oEmbed Issues

    Another social media-related block editor issue you will face is adding Facebook and Instagram content to WordPress.

    In the past, you could easily embed posts from Instagram or Facebook in WordPress. However, Facebook has changed the way oEmbed works now.

    You can no longer embed videos, images, updates, and other content in WordPress. It will instead show a plain URL of the content.

    An example of an oEmbed error in WordPress

    You can easily fix this issue using a social media WordPress plugin like Smash Balloon. It helps you embed content from Facebook and Instagram easily using oEmbed, and you can also show social media feeds on your website.

    For more details, please see our guide on how to fix the Facebook and Instagram oEmbed issues in WordPress.

    13. Unable to See Embedded Content Preview in Block Editor

    This is an issue that was raised in WordPress 5.7 version. Whenever you embedded a video from YouTube and Vimeo or added audio from Spotify and SoundCloud, the preview wouldn’t appear in the block editor.

    Instead, you would simply see ‘Preview is not available’ written in the blocks. The main cause of this problem was the default lazy loading feature.

    In WordPress 5.5, iFrames were lazy-loaded by default, which meant embedded content like pictures would not load until a visitor scrolled down to the location of the content.

    A simple fix to this issue is updating your WordPress version. This bug has since then been resolved. If you’re using version 5.7 or lower, then we highly recommend updating your WordPress to the latest version.

    We hope this article helped you learn about the common block editor issues and how to fix them. You may also want to see our guide on common WordPress errors and how to fix them, and the ultimate guide to WordPress SEO for beginners.

    If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

    The post 13 Common WordPress Block Editor Problems and How to Fix Them first appeared on WPBeginner.

  • How to Hide Blocks from Specific Users in WordPress Editor

    Are you looking for a way to hide certain WordPress blocks from a user role?

    The WordPress content editor offers a lot of flexibility in creating content using blocks. However, you may want to disable some blocks for different user roles. This is helpful if you run a multi-author website or don’t want others to access specific blocks.

    In this article, we’ll show you how to hide blocks from specific users in the WordPress content editor.

    How to Hide blocks from specific users in WordPress editor

    Why Hide Blocks from Specific Users in the Content Editor?

    WordPress blocks are content elements you add to your blog post or page. You can add blocks for images, videos, paragraphs, galleries, and more. Many WordPress plugins also add blocks to the content editor.

    Since each block lets you edit your article or landing page, it is a good idea to hide or disable some of the blocks based on WordPress user roles. This way, your website content will remain consistent and won’t have unwanted blocks and layouts.

    Let’s say you have a multi-author website. You can hide the tables block in the WordPress content editor for author and contributor user roles. This helps streamline your editorial workflow.

    Similarly, you can also prevent different user roles from using blocks added by different plugins.

    For instance, WPForms lets you embed forms in the content editor using the WPForms block. Stopping other users from accessing the block can help you stay in control and only display forms where you think is necessary.

    That said, let’s see how to hide or disable blocks for specific users in WordPress.

    Hiding Blocks for Specific Users in WordPress Editor

    The best way to hide blocks based on user roles is by using the PublishPress Blocks plugin. It gives you more control over the WordPress block editor and adds more blocks like an image slider, search bar, pricing table, and more.

    First, you’ll need to install and activate the PublishPress Blocks plugin. If you need help, then please see our guide on how to install a WordPress plugin.

    Upon activation, you can head to the Blocks item in your WordPress dashboard and click on the ‘License’ tab.

    Add PublishPress blocks license key

    Next, you can enter your license key and click the ‘Activate License’ button. You can find the license key in your PublishPress account area.

    After that, head to the ‘Block Access’ tab in the plugin. Here, you can choose a user profile from the dropdown menu at the top.

    Choose user profile to hide blocks

    To hide any WordPress block from the selected user role, simply click the toggle to disable it.

    For example, in the image below, we’ll disable the ‘table’ and ‘quote’ blocks for any user iwth the Author role.

    Click the toggle to disable blocks

    Don’t forget to click the ‘Save Block Access’ button when you’re done.

    That’s it! You’ve successfully disabled the WordPress block for a user role on your website. Now, you can repeat this to hide blocks for other user roles.

    We hope this article helped you learn how to hide blocks from specific users in WordPress editor. You may also want to see our guide on how to increase your blog traffic, and our comparison of the best-managed WordPress hosting.

    If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

    The post How to Hide Blocks from Specific Users in WordPress Editor first appeared on WPBeginner.