1. Home
  2. Knowledge Base
  3. Posts Table Pro
  4. Posts Table Pro Shortcode Options
  5. Posts table column width & image size

Posts table column width & image size

Posts Table Pro will automatically size your columns for the best fit. There are several options to override this behaviour and control the column widths, as well as the size of featured images in the table.

Column widths

Posts Table Pro will automatically calculate column widths, but you can override this using the widths option. You need to enter a value for each column in your table – either a percentage, a pixel amount or the keyword “auto” to have the plugin calculate the width automatically.

For example, you might have 3 columns in your table: title, content and date – and you want to set the width of the title column to 20%, the content column to 50% and the date column to 30%. You can achieve this using this shortcode:
[posts_table columns="title,content,date" widths="20,50,30"].

If you wanted to set the width of the first column to 50px, and automatically size the other columns, then you can use:
[posts_table columns="title,content,date" widths="50px,auto,auto"]

Auto width

By default, Posts Table Pro will automatically calculate column widths to best fit your content in the space available. Set the auto_width option to false to disable this feature.

Example: [posts_table auto_width="false"]

Image size

The image_size option controls the size of the image column if you are using this in your table. Defaults to thumbnail. You can use any standard image size (thumbnail, medium, large or full), or one or two numbers to denote the exact width and height for the image.

For example, to use the medium image size:
[posts_table columns="image,title,content" image_size="medium"]

For a square image 50 by 50 pixels:
[posts_table columns="image,title,content" image_size="50"]

For an image 50 pixels wide by 40 pixels high:
[posts_table columns="image,title,content" image_size="50x40"]

How to fix image size problems

Image sizing is very complex in WordPress, and can have unexpected results.

A few tips:

  • Your images must be the correct proportion for your chosen image size. For example, if your images are square and you set image_size="50x40" then the images will still appear square.
  • If you’re using the built-in image sizes (e.g. thumbnail, medium or large) then you can check their sizes in Settings > Media.
  • It’s possible that the width settings (see above) may be overriding your image sizes. For example, if you have set a fixed width for the image column and a specific image size then these options may conflict.
  • If you’re really struggling to get your images the correct size in the table then you can resize the original image to the correct size.

Was this article helpful?

Related Articles