Create locked pages that can later be updated across all sites in wpmu install?

I need to make a MU site where the users will create a site that will populated using New Blog Templates and they will have a few pages created by default. These are pages that they will not change or edit, they will only make blog posts but never edit pages.

So what if later I wanted to make an update to these static pages across all the existing sites?

I have seen many posts on how to create a shortcode in the functions.php file so you can create a shortcode to display content from another page(within the same site) based on the id or name something like [show_content id="ID_HERE"].

HOWEVER, I would like to display content from my default template site that I use with NBT's to create all the sub sites, not just that page from the subsite. This way I could theoretically update that one page(used for the template in nbt) and the same page would be updated across all sites in the network? Possible?

If I use the multisite content copier, would I be able to use that if I updated a page in my default template site and then use MCC copy that page across the network if that page already existed? So it would be over writing and existing page? Or will it only copy pages to a site where that page does NOT already exist?

Should I use iFrames on all my subsites since they are not editable & only display content? What if the page I was iframing had shortcodes, would they still work? I suppose I could create teh orig/template files and hide the header & footer but I guess that wouldn't be responsive and a bad idea?

So I guess I was wondering how I could later update existing pages across all sites in my network if they are all exactly the same content or how should I create the content originally to make that possible. Hope that makes sense :slight_smile:

  • Ash
    • WordPress Hacker

    Hello @George

    Welcome to WPMU community!

    I hope you are well today and thanks for asking the question.

    Multisite Content Copier doesn't do the job you want here, I am afraid.

    The easiest way is to create a custom theme for this. Where you will have code to hide/disable the Pages menu, and you will show the pages from main site only using custom query. Then use that theme to create a NBT template and create blog with that template.

    In this way, the users will be able to add only posts in their sites, not pages.

    And as the subsites are using that theme, and the theme is showing pages from main site e.g. same table, so updating the pages from main site will update the pages in all sites :slight_smile:

    Hope it helps :slight_smile: Please feel free to ask more question if you have.

    Cheers
    Ash

  • George
    • The Bug Hunter

    Thanks Ash!
    So I know how to hide the pages menu if needed but its the updatable content that I don't understand exactly.
    This part I am not sure about:

    you will show the pages from main site only using custom query

    So I understand that if I updated a theme the theme will be updated across all the sites, but what about the content in the content area? How do I get the content from say the homepage on the main site to display on content area of all the homepages on all subsites?

    Thanks!

  • Ash
    • WordPress Hacker

    Hello @George

    I hope you are well today.

    What I meant is, when you create a theme, you need to create a page with custom query: http://codex.wordpress.org/Class_Reference/WP_Query

    So, using WP_Query, you need to get post/page or other data from the main site. You can switch to main site using

    switch_to_blog(1);

    and restore to current log using:

    restore_current_blog();

    So, the content is coming from main site, doesn't matter in which subsite the theme is activated.

    Hope it helps :slight_smile: Please feel free to ask more question if you have.

    Cheers
    Ash

  • George
    • The Bug Hunter

    Hope it helps :slight_smile: Please feel free to ask more question if you have.

    Well since you offered :slight_smile:
    I am really not sure how to implement WP_Query but can that be used replicate all the content of any page? If its simple enough and you could provide a sample that would be great or I can prob just hire one of my coding buddies to help me out.

    Your suggestion will prob involve less code & no plugins but I was also suggested this plugin that I don't think I have seen mentioned here anywhere:
    https://wordpress.org/support/plugin/threewp-broadcast

    However, superadmin has to be added to each sub-site as a user to be able to update pages on the sub-sites. With that plugin I think I could also add pages or menu items to each sub-site, I just need a plugin or some other way to add my user to every site in the network before I can update all the sites.

    I know I should prob just hire someone that knows what they are doing to take care of this for me but any advice is greatly appreciated :slight_smile:

  • Ash
    • WordPress Hacker

    Hello @George

    I hope you are well today.

    You can use aftet_switch_theme hook: http://codex.wordpress.org/Plugin_API/Action_Reference/after_switch_theme
    This hook is initiated when your theme is activated.

    Then wp_insert_post to create a page: http://codex.wordpress.org/Function_Reference/wp_insert_post

    A rough example:

    add_action('after_switch_theme', 'mytheme_setup_options');
    
    function mytheme_setup_options () {
    $my_post = array(
      'post_title'    => 'My post',
      'post_content'  => 'This is my post.',
      'post_status'   => 'publish',
      'post_author'   => 1,
      'post_type'    => 'page'
    );
    
    // Insert the post into the database
    wp_insert_post( $my_post );
    }

    I never tried threewp-broadcast plugin so I can't confirm your about its usability.

    Superadmin is always "super admin" of all subsites, by default. So, when you go to Sites > All Sites and go to the Dashboard, you are automatically logged in at that dashboard unless you use any plugin that disables cross subsite cookies.

    Cheers
    Ash

  • George
    • The Bug Hunter

    I am not a coder so don't really understand. I did purchase the broadcast plugin though and now I can update everything and it didn't take long to setup with no coding :slight_smile: The developer responds in only a few minutes and it was easy to use but hopefully it will remain stable for future use. Couldn't find anything else like that for non coders.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.