Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+1 vote
706 views
in Plugins by

In my edit history plugin, I want to add a link to view the revisions of a post. I want to link the entire "post time" string, e.g. "3 months ago".

However I can't see a good was to do that. Currently I am overriding the post_meta function in the layer. I can wrap $post['when_2']['data'] in a link no problem, which links only the "3 months" text.

I tried putting the opening link tag in the 'prefix' and closing link tag in the 'suffix' parts, but this breaks the HTML:

<SPAN CLASS="qa-a-item-when-pad"><a rel="nofollow" href="../revisions/222" class="qa-a-item-revised"></SPAN>
<SPAN CLASS="qa-a-item-when-data"><SPAN CLASS="updated"><SPAN CLASS="value-title" TITLE="2012-11-01T16:34:58+0000"></SPAN>36 seconds</SPAN></SPAN>
<SPAN CLASS="qa-a-item-when-pad"> ago</a></SPAN>

Is there a way to wrap the entire code above with a link?

Q2A version: 1.5.3
by
I should also add that the above modifies the variable $post['when_2']['data'] then calls parent::post_meta() so it doesn't overwrite other users' modifications.

1 Answer

0 votes
by
Maybe you just define your own function in your qa-plugin.php and just call that instead?

Like NoahY is doing it in his badges plugin, see: https://github.com/NoahY/q2a-badges/blob/master/qa-plugin.php
by
Which function? Not sure it will solve my problem.
by
sorry Scott, I thought you could take an existing output function and use this as a modified version in your plugin. however, as I see now, there is no easy way to do it...
...