Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
0 votes
507 views
in Plugins by
Hi,

I just want to add programatically tags to a given answer and question within a plugin.

I must do this in the" function verifyItem($a_item) " of the "qa_html_theme_layer" class, which is extended by qa_html_theme_base.

Is there something like $a_item->AddTag()?

Thanks for your help
Q2A version: 1.4.3

1 Answer

0 votes
by

the theme structure works with arrays, not objects, so $a_item is an array, like everything else, and doesn't have methods, eg ->AddTag();

Also, answers don't have tags in Q2A, so you'd have to fudge it if you wanted them to have tags.

As for questions, the tags are in the ['q_tags'] index, so you do something like:

$post['q_tags'][] = 'foo';

...