The MU forums have moved to WordPress.org

Default text attached to all posts in selected MU blogs (6 posts)

  1. shogun82
    Member
    Posted 17 years ago #

    Hello.

    I have a difficult job to do. I need a plugin (or other solution) that will add default html code or text on the top and bottom of each post on selected blogs hosted by my WP MU installaion.

    This solution must have possibility to select blogs that will have this option on or off and the users of my blogs can't have access to this plugin (so they can't turn this off).

    Is there any way to write a plugin that will do this? Or maybe you know about a solution that is similar to what i need? :)

  2. SteveAtty
    Member
    Posted 17 years ago #

    Not sure if one exists. But to stop people stripping the code out then I'd suggest that you don't actually put the code into the post but use an add_filter on the_content to put your opening and closing code blocks round the contents. Inside the function you would simply check if the blog was one of the ones to be modified.

  3. kgraeme
    Member
    Posted 17 years ago #

    If you control the themes (instead of users being allowed to pick their own), then you could handle this at the theme level too.

  4. SteveAtty
    Member
    Posted 17 years ago #

    true, but its a lot more editing going through the theme files and adding stuff in.

  5. shogun82
    Member
    Posted 17 years ago #

    Editing themes is not an option. Then again usual plugin is not an option too - because a single user could disable this plugin even if i will activate it site wide.

    I have nothing against editing core WP files. I think that considerable solution for me would be to add an option in the settings section of an admin panel, for example "announcements" or something like that.

    Under this option i would like to have a list of all blogs and with simple checkbox'es i could choose blogs that will display certain html code in top and bottom of posts.

    Under that option would be also 4 textareas, for code of the top and bottom of the post and for wp_head and wp_footer functions (for styling in head sections of themes and google analitics code in footers).

    Can sameone give me a tip on how i can achieve this? :)

  6. andrea_r
    Moderator
    Posted 17 years ago #

    Then stick the plugin in the mu-plugins folder. Users can't disable those.

    So, as an addition to Steve's suggestion, you add the menu items you want under Site Admin. Stuff the results in an array and off you go.

    GA in the footers has been covered multiple times and has had a few plugins released. No need to reinvent the wheel on that bit. And if the certain html code is adsense code - well, they;ve been done. Jsut not the "pick which blogs to show on" part.

About this Topic

  • Started 17 years ago by shogun82
  • Latest reply from andrea_r