Notifications
Clear all

[Solved] How to toggle a topic custom field table in the thread?

2 Posts
1 Users
0 Reactions
434 Views
Posts: 4
Topic starter
(@user1)
Active Member
Joined: 12 months ago

I'm using the Topic Custom Fields addon. I'm wondering is it possible to add a toggle link/button in the thread (e.g., in the Q&A layout), to show/hide the custom field table? E.g., a link/button that say "More Info" that show/hide the custom field table. I'm thinking something along the lines of adding a simple anchor element or button, and use javascript to show/hide the custom field table. It will be great if this can be added as a built-in feature for the Topic Custom Fields addon.

If it is not possible to add in as a built-in feature, can you advice on how to best customize this, perhaps there is a php template file for each of the layout that I may be able to edit? Though the cleaner way would be to have it part of the next release if possible.

Thank you very much!

1 Reply
Posts: 4
Topic starter
(@user1)
Active Member
Joined: 12 months ago

Found this filter hook below that is called just before the custom fields table, great! I'll mark this solved now.

add_filter('wpforo_topic_fields_before', 'custom_function', 10, 2);

function custom_function( $html, $post ) {

$html = ... // Inject HTML here 

return $html;

}

Reply