
Want to drop your ProFeedWP LinkedIn feed into any Elementor or Divi layout? Create the feed on a simple Gutenberg page, then embed that page anywhere with this tiny shortcode.
1) Install the shortcode
Add this to a small plugin or your theme’s functions.php:
/**
* Shortcode: [render_page_content id="123"] or [render_page_content slug="my-feed-page"]
*/
function pfwp_render_page_content_sc( $atts = [] ) {
$atts = shortcode_atts(['id'=>'','slug'=>'','wrap'=>'div','class'=>'pfwp-embedded-content'], $atts,'render_page_content');
$target_id = $atts['id'] ? absint($atts['id']) : 0;
if (!$target_id && $atts['slug']) {
$p = get_page_by_path( sanitize_title($atts['slug']), OBJECT, ['page','post'] );
if ($p) $target_id = (int) $p->ID;
}
if (!$target_id || get_the_ID() === $target_id) return '';
$post = get_post($target_id);
if (!$post || 'publish' !== $post->post_status) return '';
static $stack=[]; if (in_array($target_id,$stack,true)) return ''; $stack[]=$target_id;
$prev = $GLOBALS['post'] ?? null; $GLOBALS['post']=$post; setup_postdata($post);
$html = apply_filters('the_content', $post->post_content);
wp_reset_postdata(); $GLOBALS['post']=$prev; array_pop($stack);
$wrap = in_array($atts['wrap'], ['div','section','article','span'], true) ? $atts['wrap'] : 'div';
return sprintf('<%1$s class="%2$s" data-source-id="%3$d">%4$s</%1$s>', $wrap, esc_attr(sanitize_html_class($atts['class'])), (int)$target_id, $html);
}
add_shortcode('render_page_content', 'pfwp_render_page_content_sc');
Code language: PHP (php)
2) Create your “feed page”
- Create a new page and choose the native Gutenberg editor. Make a page that contains just the ProFeedWP – LinkedIn Feed block. Publish it and note the ID or slug.
- Make sure to hide it from search engines (If you use Yoast, set the ‘Allow search engines to show this Page in search results?‘ to No )
3) Embed it anywhere
- Elementor: Shortcode widget →
[render_page_content id="123"] - Divi: Code module →
[render_page_content id="123"]
(Or useslug="your-page-slug".)
Notes: Renders through the_content (so dynamic blocks work), prevents loops, and works with posts or pages. Keep the feed page minimal for best performance.
Need help?
Don’t hesitate to contact us if you need help implementing ProfeedWP on your Divi or Elementor site (or any other page builder).