Discover in this tutorial how to insert in a CPT entries page a column that displays the Restrict Content Pro content drip data.
If you use the Restrict Content Pro addon that allows drip content and you want to have more control over how often each CTP entry is released you may want to add a new custom column that displays it in the WordPress admin.
This is especially interesting when you have lots and lots of entries with different release times. This way you can get all the information at a glance.
This would be the final result:
Let’s see how to achieve it.
Snippet to show Restrict Content Pro Drip Content addon data
Add the following code snippet to your functionality plugin:
To see this and another 1097 code snippets of this website, login or subscribe here.
In this code you use the manage_course_posts_columns
and manage_course_posts_custom_column
filters to add the header and column content respectively. The text displayed in the header is “Drip” but you can modify it.
To get the values, you access the information in the rcp_drip_schedules
table which is where the addon stores the data about the content drip (separated in units and period).
This code is intended to be displayed on the page where all the courses are listed in the WordPress backend. If you want it to be displayed in another Custom Post Type you have to modify the name of the filters. You have to replace “course” with the name under which the CPT is registered. That is, the name of the filters has to follow the following format: manage_{cpt}_posts_columns
and manage_{cpt}_posts_custom_column
.
With the snippet you also add some CSS so that the column occupies an appropriate width, in this case 60 pixels, but you can adjust it to your liking.
Conclusions
Do you have a lot of posts that are released by content drip and you want to have the data at hand to analyze them at a glance? Now you know how to display it by adding a new column in the WordPress admin with a code snippet.
Any questions? Let me know in the comments.
And if you want to give me any suggestion for future tutorials, leave it in the contact form. Advantages of being a subscriber. 😉