Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+1 vote
295 views
in Plugins by
Just realized by transferring some plugins to the latest q2a version 1.6.2 that the custom output is handled differently now.

Before we had to define:

$c = 2;
$qa_content['custom'.++$c]='<p>my output</p>";
$qa_content['custom'.++$c]='<p>my output II</p>";

which gave a clean output in 1.5.4:

<p>my output</p> <p>my output II</p>

Now in v1.6.2 I get this instead:

<div class="qa-part-custom3">
   <p>my output</p>
</div>

<div class="qa-part-custom4">
   <p>my output II</p>
</div>

Why was that changed? That could corrupt a lot of plugins I assume.
Q2A version: 1.6.2
by
*** How can we output now the content without these extra classes??

2 Answers

+1 vote
by

Yes you are right.. I had problem with lot of custom plugin I have done for clients.

Only simple different is you can do is just concatenate the previous $content variable using .=

So the code witll be in this way

$qa_content['custom']  = 'your first line'; //usually very first string or empty

$qa_content['custom'].='<p>my output</p>";

$qa_content['custom'].='<p>my output II</p>";

by
When I use AJAX features, throw a request to a page, I receive also these new DIVs inside. :(

On the other hand, I understand that Gideon wants to make it clear that this is custom information by adding the DIV(s). However, I guess this is not necessary. Especially not if I am on a page that has been created by a plugin.

Btw, this is why I am always very careful if it comes to updates. They can lead to new problems and a lot of extra work :(
by
The responsible part for those extra classes is: qa-theme-base.php, from line 744 to 748:

if ($partdiv)
    $this->output('<div class="qa-part-'.strtr($key, '_', '-').'">'); // to help target CSS to page parts

if (strpos($key, 'custom')===0)
    $this->output_raw($part);

The extra classes are unnecessary in my point of view. I have not seen any plugin that targets e.g. "qa-part-custom3".
by
Thanks Kai you found the reason.. I

In fact I have already requested here to remove wrapper for custom content. I found it is useless since developer most of the time adds own wrapper.
by
absolutely right, nice that we think the same here :)
0 votes
by

I am sad to say that but I did a core hack to solve this problem, it is a one liner (I know I could override function main_part() but I don't see the point in adding 50 lines to my theme file when I can remove 1 line in the core...

qa-theme-base.php remove line 733: (strpos($key, 'custom')===0) ||

Now my plugins work again!

...