Web Design

How to convert from container to column in WordPress 


Sushil Pradhananga

Published On : 

August 28, 2023

To convert a container into a column in WordPress, you’ll need to work with the HTML and CSS of your WordPress theme. Themes typically use CSS classes and sometimes shortcodes or page builders to create columns. We are going to show the conversion process using a custom CSS file rather than using Elementor or any other page builder with drag and drop features.

Step-by-Step Guide to Convert from Container to Column Layout in WordPress Website

Here are the general steps to convert a container to a column without affecting user experience:

Step 1: Backup Your Site

Before making any changes to your website, it’s essential to create a comprehensive backup. Backing up your site ensures that you can revert to a previous state if anything goes wrong during the editing process. There are several ways to back up your site:

Use a Backup Plugin: There are variety of backup plugins, such as UpdraftPlus and BackupBuddy. These plugins allow you to create full backups of your website, including both files and the database, and store them securely.

Manual Backup: If you prefer a manual approach, you can use your hosting control panel or an FTP client to download all your website files and export your WordPress database.

Managed Hosting Backups: Some managed WordPress hosting providers offer automatic daily backups. Check with your hosting provider to see if this service is available to you. Once you have a backup in place, you can proceed with confidence, knowing that your site’s data is safe.

Step 2: Access Your WordPress Theme Files 

To convert a container into a column, you’ll need to access and edit your theme’s 

FTP Method:

  • Install an FTP Client: If you don’t have one already, download and install an FTP client like FileZilla.
  • Connect to Your Server: Open your FTP client and connect to your web server using your FTP credentials (usually provided by your hosting provider).
  • Navigate to Theme Directory: Navigate to the wp-content/themes/ directory on your server. Here, you’ll find folders for all the themes installed on your site. Locate the folder for your active theme.

WordPress Dashboard Method:

  • Login to Your WordPress Dashboard: Log in to your admin area.
  • Access the Theme Editor: In the admin menu, go to Appearance and select Theme Editor. From the right-hand side, choose your theme from the dropdown list.
  • Select the File to Edit: On the Theme Editor page, you’ll see a list of theme files on the right. Select the file you want to edit. In most cases, you’ll be working with style.css for CSS changes or a template file (e.g., page.php, single.php, or content.php) for HTML changes.  

Step 3: Identify the Container element which you need to change to a column in WordPress

Before making any changes, identify the specific container layout you want to convert into a column. Containers are typically represented by HTML elements, such as <div>, <section>, or <article>, and often have class or ID attributes assigned to them.
In this example, the <div> element with the class “container” is the container we want to convert into a column.

<div class="container">
<!-- Content goes here -->

Step 4: Add CSS Classes to update column design

To style the container as a column, you’ll need to add CSS classes to it. You can do this by editing the HTML directly or by using custom CSS. By using CSS you can create a visually appealing Column layout.

Edit the HTML Directly: In your theme file, locate the container element, and add a class attribute with a relevant name. For example:

<div class="column-container">
<!-- Content goes here -- >

In this case, we’ve added the class “column-container” to the <div> element.

Use Custom CSS: If your theme provides a custom CSS option (often found in the WordPress Customizer under “Additional CSS” or in a theme options panel), you can add CSS rules to style the container as a column. Here’s an example of what this might look like in your custom CSS:

/* CSS properties to create a column */

In this CSS rule, “column-container” is the class we added to the container in the HTML.  

Step 5: Style Your Column structure

With the CSS class in place, you can now define the properties that will transform your container layout to a column. Here are some common CSS properties you might use: .column-container

{   float: left; /* Float the column to the left */
    width: 50%; /* Set the desired column width (adjust as needed) */
    margin-right: 20px; /* Add spacing between columns if needed */
    padding: 10px; /* Add padding for spacing within the column */

Let’s break down what each of these properties does:

float: left; – This property floats the container to the left, allowing other content to wrap around it. This is a common technique for creating columns.

width: 50%; – This sets the width of the column to 50% of its parent element, effectively creating a two-column layout. You can adjust this value to create columns of different widths.

margin-right: 20px; – This property adds a margin to the right of the column to create spacing between columns. Adjust the value to control the spacing.

padding: 10px; –  Padding adds space inside the column, separating the content from the container’s edges. Adjust the value as needed for spacing within the column. These CSS properties are just examples. Depending on your design and layout requirements, you may need to customize them further.  

Step 6: Update Content

With the container styled as a column, ensure that the content within the container adapts to the new column layout. This is particularly important if you’re converting a text container into a column. You may need to adjust the content’s formatting to make it fit within the column width.

For example, if you have a paragraph of text within your container, you might want to adjust the text’s line length or font size to ensure it looks good within the column.

Step 7: Test Responsiveness

It’s crucial to test your column layout on different devices and screen sizes to ensure that it remains responsive and looks good on all screens. Responsive design ensures that your website is accessible and user-friendly on mobile devices, tablets, and desktops.

To test responsiveness:

Resize Your Browser: Manually resize your browser window to see how the column layout adapts to different screen widths.

Use Browser Developer Tools: Most modern browsers offer developer tools that allow you to simulate various device sizes. Right-click on your webpage and select “Inspect” or “Inspect Element” to access these tools. In the developer console, look for a responsive design mode or device emulation option.

Mobile Devices: Test your website on actual mobile devices, if possible, to ensure that the column layout is mobile-friendly.

If you notice any issues with responsiveness, you may need to use CSS media queries to adjust the styling for different screen sizes. Media queries allow you to apply specific styles based on the user’s screen width. For example, you can use a media query like this to change the column layout on smaller screens:

@media screen and (max-width: 768px) 
    width: 100%; /* Make the column full width on smaller screens */    
margin-right: 0; /* Remove margin for spacing between columns */   

This CSS rule makes the column full-width and removes the right margin on screens with a maximum width of 768 pixels.

Step 8: Save Changes

After making your changes to the theme’s files or custom CSS, don’t forget to save your work:

  • If you’re editing theme files via FTP, save the file on your local machine, and then upload it back to the server.
  • If you’re using the WordPress Theme Editor, click the “Update File” button to save your changes.

Step 9: Clear Caches

If your website uses caching plugins or a Content Delivery Network (CDN), clearing the cache is essential to see your changes immediately. Caches store copies of your website’s pages to improve loading times, but they can also prevent you from seeing updates in real-time. The method for clearing caches depends on the caching solution you’re using. Consult the documentation for your caching plugin or CDN provider for instructions on clearing the cache.

Step 10: Preview and Debug

Before considering your changes final, it’s essential to preview your website and check for any issues or unexpected behavior. Use browser developer tools to inspect elements and debug any CSS or layout issues. Here are some common things to look for:

  • Check that the container has been successfully converted into a column and that the styling is consistent across different pages if applicable.
  • Ensure that the content within the column displays correctly and that there are no text overflow issues.
  • Verify that the column layout remains responsive and looks good on various screen sizes.
  • Test any interactive elements, such as links and buttons, to make sure they function correctly within the column.

If you encounter issues, use your browser’s developer tools to inspect the elements causing problems and make adjustments to your CSS accordingly.

Step 11: Document Changes

Documenting the changes you’ve made to your WordPress theme is essential for future reference and troubleshooting. Here’s what you should document:

  • The specific theme files you edited or the custom CSS you added.
  • The CSS classes or IDs you used to target the container you converted into a column.
  • The CSS properties and values you applied to create the column layout.
  • Any media queries you added for responsiveness.
  • Any issues you encountered and how you resolved them.

By keeping detailed records of your changes, you’ll have a reference to help you make further modifications or updates in the future.
In summary, converting a container into a column in WordPress involves several steps, from backing up your site to styling the column with CSS. It’s essential to approach this process with caution, regularly test your changes, and document your modifications for future maintenance. With the right care and attention to detail, you can achieve the desired column layout for your WordPress website.

Humming Web

Let’s talk about your business goal and align the solution we provide with our digital marketing services.

FREE strategy call

© Humming Web. All Rights Reserved