• Resolved borishu

    (@borishu)


    Hello,

    So I’m fairly new to WordPress, I have a solid understanding of the basics (I think) and have put together a site that is coming along rather well.

    My question comes down to quality-of-life and building templates, etc to make my life easier.

    Currently when I want to post a new product review on my website, I have to make a page from scratch, insert some of the same shortcode (headings, etc) then publish it. Is there a way to make a template that has all my headings pre-built so I only need to add the copy text?

    This is currently an issue because say I want to change the text of a common heading… I have to go update it in 30+ places.

    My other question is similar, say I have a block of code I like to use for a certain decorative element that displays information. Can I create a template for just this element and use WordPress to insert it where I need it with dynamic content? Right now I use a notepad document that I copy and paste it out of.

    Thanks!

Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    For the general page where you have the same content over and over (not necessarily verbatim, but always using the same logic), you will want to build a custom page template. Such templates could pull data from a number of fields, you are not limited to the default page content field. It can come from the default custom fields, or additional textarea boxes could be added as part of the edit screen. Many people use Advanced Custom Fields for this, but if you’re able to do some custom coding, you can add your own meta boxes containing any sort of form fields you like.

    As for randomly inserting pre-defined elements as needed, you will want to create custom shortcodes for that. A single word in square brackets could be expanded by code into very elaborate content. You can introduce variability into shortcodes by passing parameters or including specific content. Some shortcode examples that could be expanded into just about anything you can imagine:
    [foo]
    [foobar id=”123″]
    [foobar]Some special text to use in the expansion[/foobar]

Viewing 1 replies (of 1 total)
  • The topic ‘WordPress Post “Inheritance” (?) and Templating’ is closed to new replies.