Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #451860

    I’d like to be able to setup a color section like a widget. I’d like to be able to set it up once, use it on multiple pages, have one place to go to make changes to it, and have those changes picked up by all pages that use it.

    I know you could create it on a page, save that page as a draft, then use a page duplicator plugin to create new pages from it. However that would be the same principle as creating a Word file from a template then doing a Save As to save it as a different file. The problem with doing it this way is that if I had 10 pages based on this template, any changes would still need to be made on all 10 pages. And I don’t want all site pages based on this “color section widget”, so I can’t just make changes to a child theme’s header.php file or something like that.

    Any advice for how I might kludge it in version 3.1.5?

    Any chance this type of functionality might be on the drawing board for a future release?

    #451869

    Hey!

    You can use the following (child theme functions.php):

    add_action('ava_after_main_title', function() {
    	?>
    		SECTION HTML HERE
    	<?php
    });

    Now, you’d need to create the Color Section you want to be repeatable first and then copy the generated HTML (using something like Chrome DevTools).

    Regards,
    Josue

    #452304

    Hi Josue:

    Wouldn’t that affect ALL pages? I’d only want the same color section on certain pages, not all of them.

    Thanks!

    Scott

    #452319

    Hi Scott,

    You can mix it with is_page and pass the Page IDs of the pages you want to affect:

    add_action('ava_after_main_title', function() {
    if(is_page(array(2,3,4,5)){
    	?>
    		SECTION HTML HERE
    	<?php
    }
    });

    Best regards,
    Josue

    #452877

    Thanks Josue! I’ll give it a try.

    #452879

    Cool, looking forward to hearing from you :)

    Regards,

    Josue

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.