Create dynamic content from one WP page to multiple other pages

I want to create dynamic content that is taken from a specific paragraph from one page and writes to a paragraph on multiple pages that feature that same content. I am new to PHP and not sure how to make this happen in WordPress.

I have an existing WordPress webpage, let's call it the Plan, with paragraphs on it. The content of these paragraphs changes from time to time. The content in the Plan paragraphs is also on other existing WordPress pages, call these other pages Profile pages. I am trying to be more efficient by only writing the content once on my website and feature that content on other webpages with some script. I can give the paragraphs on the Plan page IDs.

On the Profile pages, how do I call specific paragraph IDs from the Plan page to write the paragraph content?

Topic shortcode php templates content Wordpress

Category Web


Another workaround that you could do is creating a widget of this paragraph.

You will need to install a plugin as described in: How to Add WordPress Widgets in Post and Page Content

You can now make a text widget of this paragraph and just add [do_widget paragraph] on all your pages where you want to show the paragraph. (the word paragraph in this example is variable to the name that you are giving the widget).

Changing the widget text will now change the text on all pages in one save


The WordPress doesn't operate with concept of partial content. The content of the post is seen as single block of text/markup, possibly with embedded external elements. Even in latter case that is considered one way flow — content output will process embeds, but embeds aren't meant to be extracted from content.

In your case I would guess the data architecture would depends on how standalone "paragraphs" really are.

I see roughly two cases:

  1. Paragraph is a Custom Post Type (each of them, or post per collection of paragraphs), which are created/managed independently and which pages & profiles embed in some form.

  2. Paragraphs are a Custom Field of page (part of its meta data) and managed together with it, which profiles access through the page's ID.

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.