Skip to:
Content
Pages
Categories
Search
Top
Bottom

Changing the word Courseware to something else

  • Avatar of Prometheus Fire
    Prometheus Fire
    Participant

    @prometheus-fire

    Stas,

    I want to change all front-facing instances of the word “Courseware” to “Classroom” (or maybe something else in certain areas of the site). Is there an easy way to do this without a line-by-line reading of the entire plugin code?

    Additionally, have a facility to rename Courseware to whatever we want in the back-end dashboard might be useful as you start to look at this plugin again this year. On a production site, we need to be able to re-name it easily to meet our needs. Anyhow, how do I change it via the code?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Avatar of nicholmikey
    nicholmikey
    Participant

    @nicholmikey

    `
    function before_header() {
    ob_start(“callback”);
    }

    function callback($buffer) {
    $buffer = str_replace(‘Courseware’, ‘Classroom’, $buffer);
    return $buffer;
    }

    function buffer_end() {
    ob_end_flush();
    }

    add_action(‘wp_head’, ‘before_header’, 1);
    add_action(‘wp_footer’, ‘buffer_end’, 1);
    `

    Sitewide. Mine is in my bp-custom.php file.

    This is a quick fix, really you should go through the code and change it.

    Avatar of Stas Sușcov
    Stas Su?cov
    Participant

    @sushkov

    @nicholmikey is not the best, but it is a solution.
    Another solution you might want to consider is adding a filter to `gettext` (something like this) or just update the localization file with the value you need for entry `Courseware`.

    Avatar of Prometheus Fire
    Prometheus Fire
    Participant

    @prometheus-fire

    @nicholmikey that code worked, but I started getting header rewrite errors (my theme is pretty heavy and probably caused this)

    An interesting side effect was that when I edited a forum post with the word “Courseware” in it, when I saved it, the automatically changed it (on its way to the database) to “Classroom”. Would be a clever way to filter out curse words too!

    I may take a look at the localization file method and see if I can figure out how to do it that way, but doesn’t that change the core code?

    Avatar of Stas Sușcov
    Stas Su?cov
    Participant

    @sushkov

    No it doesn’t. Just place the code in a plugin, that’s all.

Viewing 4 replies - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.