Docly

How to Add Custom Column using Action and Filter Hooks

Estimated reading: 2 minutes 231 views

Note: Usually you can write codes inside the theme's functions.php file. If any hooks are not working on the theme's functions.php file, (only then) please download our helper addons plugin and write hooks inside this plugin.

In the Woo Product Table plugin, there are lots of columns already added. But for you, maybe those are not enough. You wanted to add more custom columns. That's why I am writing this tutorial.

First, we have to add our custom column to the default column array using wpto_default_column_arr filter.

We have added our new shortcode column to the default column array. Now we need a file where we can add the content for that custom shortcode. This code is used in our addon plugin. Which you can find at branch New Shortcode Column - link to https://github.com/codersaiful/UltraAddons-addons/tree/new_shortcode_column

Below we have used wpto_template_loc_item_ . $keyword filter.

Now we need to add an input field to get the custom shortcode from the user. Here we have used wpto_column_setting_form_ . $keyword action to add the input field inside the column area in the column tab.

Now we have to show the shortcode content using our custom file. Here we have used hello.php

CONTENTS