render content with widget posts
-
Hi,
I am using the Posts Widget, and trying to render post content that includes a and span tags, however unsuccessful with the excerpt option enabled. Is it possible at all to display the WYSIWYG edited post content this way? I would be grateful for any advice. Thanks.
add_filter('elementor/widget/render_content', 'add_excerpt_link', 10, 2); function add_excerpt_link($content, $widget) { if ('elementor-widget-posts' !== $widget->get_name()) { return $content; } $pattern = '/(<span class="original-price">.*?<\/span>)/i'; $replacement = '<span style="font-weight: bold; font-style: italic;"><a href="..." target="_blank" rel="nofollow sponsored noopener">$1</a></span>'; $new_content = preg_replace($pattern, $replacement, $content); return $new_content; }
The page I need help with: [log in to see the link]
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘render content with widget posts’ is closed to new replies.