<?xml version="1.0" encoding="UTF-8"?>        <rss version="2.0"
             xmlns:atom="http://www.w3.org/2005/Atom"
             xmlns:dc="http://purl.org/dc/elements/1.1/"
             xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
             xmlns:admin="http://webns.net/mvcb/"
             xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
             xmlns:content="http://purl.org/rss/1.0/modules/content/">
        <channel>
            <title>
									Issue with add inline feedback forms to each paragraph. - wpForo Official Addons				            </title>
            <link>https://gvectors.com/forum/official-wpforo-addons/issue-with-add-inline-feedback-forms-to-each-paragraph/</link>
            <description>WordPress Plugins Support Forum</description>
            <language>en-US</language>
            <lastBuildDate>Tue, 06 Oct 2026 12:45:10 +0000</lastBuildDate>
            <generator>wpForo</generator>
            <ttl>60</ttl>
							                    <item>
                        <title>RE: Issue with add inline feedback forms to each paragraph.</title>
                        <link>https://gvectors.com/forum/official-wpforo-addons/issue-with-add-inline-feedback-forms-to-each-paragraph/#post-40468</link>
                        <pubDate>Sat, 31 Aug 2024 12:21:37 +0000</pubDate>
                        <description><![CDATA[Hi,
Please note all questions related to the free wpDiscuz plugin should be asked in the wpDiscuz.com forum. Here we only support issues related to paid addons.]]></description>
                        <content:encoded><![CDATA[<p>Hi,</p>
<p><span>Please note all questions related to the free wpDiscuz plugin should be asked in the<a href="https://wpdiscuz.com/community" target="_blank" rel="noopener"> </a></span><a href="https://wpdiscuz.com/community" target="_blank" rel="noopener">wpDiscuz.com forum</a><span><a href="https://wpdiscuz.com/community" target="_blank" rel="noopener">.</a> Here we only support issues related to paid addons.      </span></p>]]></content:encoded>
						                            <category domain="https://gvectors.com/forum/official-wpforo-addons/">wpForo Official Addons</category>                        <dc:creator>Astghik</dc:creator>
                        <guid isPermaLink="true">https://gvectors.com/forum/official-wpforo-addons/issue-with-add-inline-feedback-forms-to-each-paragraph/#post-40468</guid>
                    </item>
				                    <item>
                        <title>Issue with add inline feedback forms to each paragraph.</title>
                        <link>https://gvectors.com/forum/official-wpforo-addons/issue-with-add-inline-feedback-forms-to-each-paragraph/#post-40464</link>
                        <pubDate>Fri, 30 Aug 2024 16:55:10 +0000</pubDate>
                        <description><![CDATA[Description: I am developing a custom feature for a WordPress site that integrates with the wpDiscuz plugin. The goal is to add inline feedback forms to each paragraph of a post using the wp...]]></description>
                        <content:encoded><![CDATA[<p><strong>Description</strong>: I am developing a custom feature for a WordPress site that integrates with the wpDiscuz plugin. The goal is to add inline feedback forms to each paragraph of a post using the <code>wpdiscuz-feedback</code> shortcode. While the shortcode works correctly when used directly in post content, it does not function properly when invoked programmatically through my custom function <code>addInlineFeedbackToParagraphs</code>.</p>
<pre contenteditable="false">function addInlineFeedbackToParagraphs($content) {
    global $post;

    // Ensure this only applies to single post views where comments are open
    if (!is_single() || !comments_open($post-&gt;ID)) {
        return $content;
    }

    // Split content by paragraphs
    $paragraphs = explode('&lt;/p&gt;', $content);

    foreach ($paragraphs as $index =&gt; $paragraph) {
        if (trim($paragraph)) {
            // Create a unique ID for each paragraph
            $unique_id = 'inline-' . $post-&gt;ID . '-' . $index;

            // Wrap each paragraph with wpDiscuz feedback shortcode
            $paragraphs = '' . $paragraph . '&lt;/p&gt;';
        }
    }

    // Reassemble the content
    return implode('', $paragraphs);
}

// Hook the function to 'the_content' filter
add_filter('the_content', 'addInlineFeedbackToParagraphs');
</pre>
<h3>Problem Details</h3>
<ol>
<li>
<p><strong>Function Behavior</strong>:</p>
<ul>
<li>The <code>addInlineFeedbackToParagraphs</code> function is designed to wrap each paragraph in a post with the <code>wpdiscuz-feedback</code> shortcode to display a feedback form for each paragraph.</li>
<li>The function is hooked to <code>the_content</code> filter and iterates through each paragraph, applying the shortcode dynamically using <code>do_shortcode()</code>.</li>
</ul>
</li>
<li>
<p><strong>Observations from Debugging</strong>:</p>
<ul>
<li>The function executes correctly and iterates through the paragraphs.</li>
<li>The <code>wpdiscuz-feedback</code> shortcode is applied successfully when added manually to post content but fails when invoked via <code>do_shortcode()</code> within my function.</li>
<li>The error log shows repeated messages of "No feedback form applied for paragraph X", indicating the shortcode is not processed as expected when dynamically inserted.</li>
</ul>
</li>
<li>
<p><strong>Debugging Steps Taken</strong>:</p>
<ul>
<li>Verified that the conditions to apply the shortcode (<code>wpDiscuz</code> loaded, comments open, user permissions) are correctly met.</li>
<li>Confirmed that <code>do_shortcode()</code> is correctly invoked and returns the expected content format.</li>
<li>Checked for potential conflicts with multiple hooks or filters, ensuring the function only runs during the main query.</li>
<li>Added extensive logging to track each step and outcome within the <code>addInlineFeedbackToParagraphs</code> function.</li>
</ul>
</li>
<li>
<p><strong>Potential Causes Considered</strong>:</p>
<ul>
<li>Plugin settings or configuration preventing dynamic shortcode processing.</li>
<li>A bug or limitation in the <code>wpdiscuz-feedback</code> shortcode when used programmatically versus manually.</li>
<li>Conflict with another filter or plugin interfering with the <code>the_content</code> filter or <code>do_shortcode()</code> processing.</li>
</ul>
</li>
<li>
<p><strong>Request for Assistance</strong>:</p>
<ul>
<li>Guidance on whether the <code>wpdiscuz-feedback</code> shortcode supports dynamic execution via <code>do_shortcode()</code> in custom functions.</li>
<li>Any known limitations, conflicts, or alternative methods to achieve inline feedback functionality for each paragraph.</li>
<li>Suggestions for debugging steps or configurations to check that may resolve this issue.</li>
</ul>
</li>
</ol>
<p><strong>Thank you for your support!</strong></p>]]></content:encoded>
						                            <category domain="https://gvectors.com/forum/official-wpforo-addons/">wpForo Official Addons</category>                        <dc:creator>MASSTACK</dc:creator>
                        <guid isPermaLink="true">https://gvectors.com/forum/official-wpforo-addons/issue-with-add-inline-feedback-forms-to-each-paragraph/#post-40464</guid>
                    </item>
							        </channel>
        </rss>
		