0

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?

  • 2
    Could you provide more extensive example maybe? Do you mean existing WordPress page pages, or URLs, or what? – Rarst May 8 '15 at 21:32
0

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.

  • Thank you I will research Custom Post Types and Custom Fields for WordPress and see if these are solutions and will post my findings. – Peggy Lee Oster May 11 '15 at 14:17
0

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.