R
R
rser2018-09-21 01:04:00
CMS
rser, 2018-09-21 01:04:00

How to display the content of one page (body) on any other in Wordpress?

I am in contact with a project (site) on WordPress, faced with the task of how to substitute the content of one page into all others:
An example of the site structure (many sites are created according to this type):

  • Menu (...)
  • Header (%title% and %button%)
  • Content (static data: benefits, our work, our clients...)
  • Basement

The menu, header, and footer are static elements relative to the rendered content of the page.
But the content must be the same for any created page.
My visions for solving this issue:
You can do the following:
1) Solution: When creating a new page, customize the title and header individually (in the WP interface), and fill the body (content) by "Copied - Pasted" the desired content.
Cons: When it comes time to change the data, you will need to open and adjust the body of each page.
2) Solution: Tampering with the template source code of the theme being used
Cons:It will be impossible for an ordinary user to change the output data on all pages without the help of a programmer (coder)
3) Solution: Use a plugin that allows you to display the desired page (or a blank that can be edited as a simple page separately) - on any other within the WP (editor) interface pages, for example)
Cons: I don’t know about the existence of such plugins, there is a risk of not detecting such a plugin
. Perhaps point 3 is already built into the basic functionality of WordPress, but futile attempts to find information on this issue on search sites and in the information and educational environment ( YouTube, WordPress Help) - were unsuccessful.
The whole question can be put in simple terms like this:
How to set up the output of the content of any created page using the WordPress CMS in such a way that the body (content) of another page is added to the page body block .
  • "any created page" - existing and new pages, for example /index/, /contacts/, /kak-sdelat-svoimi-rukami/, /.../ etc.
  • "other page" - any other page from which we need to take only content without headers and without a footer.
  • "body (content)" - page content that can be created in the WordPress page editor interface

Answer the question

In order to leave comments, you need to log in

2 answer(s)
L
La1serg, 2018-09-21
@La1serg

1. Create a page where you will add content that will be displayed on other pages.
2. You create a new template for such pages.
3. In the template you call get_post_field( $field, $post, $context );
4. ...
5. profit!

I
id_baton4eg, 2018-09-21
@id_baton4eg

Implementation methods: 1) Add to the required part of the
get_posts template - display what is needed
data, or using the same hook we add content after or before the main entry. (See the wp hook base)
3) Create your own page template in php, display a different layout there, select the display of the desired layout on the required pages.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question