Hi,

I use Omega 4 subtheme and I would like remove the "Welcome" & "No Content is created" messages at front page.

Here is my template.php file:

function MYTHEME_preprocess_page(&$vars) {
    if (drupal_is_front_page()) {
        unset($vars['page']['content']['system_main']['default_message']); //will remove message "no front page content is created"
        drupal_set_title(''); //removes welcome message (page title)
    }
}

I got blank white page after implementing this.

Any idea?

Thanks.

hc.

Comments

Jaypan’s picture

Try changing this:

unset($vars['page']['content']['system_main']['default_message']);

To this:

$vars['page']['content']['system_main']['default_message']['#markup'] = '';
chanjay’s picture

It still doesn't work.

This is so weird, I used the same code on different project before (but not using Omega theme) and it worked.

hc.

Jaypan’s picture

Sorry, there was an error in my suggested replacement. I have edited my post, try my suggested code now.

chanjay’s picture

Jaypan, Thanks but I still see blank white page on this code.

function MYTHEME_preprocess_page(&$vars) {
    if (drupal_is_front_page()) {
        $vars['page']['content']['system_main']['default_message']['#markup'] = '';
    }
}

hc.

Jaypan’s picture

What's the output if you do the following:

die('<pre>' . print_r($vars['page']['content']['system_main'], TRUE) . '</pre>');
chanjay’s picture

The below code produces blank white page.

function MYTHEME_preprocess_page(&$vars) {
    if (drupal_is_front_page()) {
        die('<pre>' . print_r($vars['page']['content']['system_main'], TRUE) . '</pre>');
    }
}

But the below code (removed "preprocess")

function MYTHEME_page(&$vars) {
    if (drupal_is_front_page()) {
        die('<pre>' . print_r($vars['page']['content']['system_main'], TRUE) . '</pre>');
    }
}

produces the results as follow over blank white background.

Array
(
    [default_message] => Array
        (
            [#markup] => 
No front page content has been created yet.

Add new content


            [#prefix] => 

            [#suffix] => 

        )

    [#block] => stdClass Object
        (
            [bid] => 37
            [module] => system
            [delta] => main
            [theme] => macrotron
            [status] => 1
            [weight] => 0
            [region] => content
            [custom] => 0
            [visibility] => 0
            [pages] => 
            [title] => 
            [cache] => -1
            [subject] => 
        )

    [#weight] => 1
    [#theme_wrappers] => Array
        (
            [0] => block
        )

)

hc.

Jaypan’s picture

Ok, we're getting closer. Try this:

function MYTHEME_page(&$vars) {
    if (drupal_is_front_page()) {
        $vars['page']['content']['system_main']['default_content']['#markup'] = '';
    }
}
chanjay’s picture

Now the welcome message, logo, & slogan are all gone.

hc.

Jaypan’s picture

Can't help beyond that. I don't see any reason why your logo and slogan would be removed by that.

chanjay’s picture

Thank you Jaypan I appreciate your time & efforts to help me.

hc.