Buddypress - Function won't work on front

Hello I got this function that lets the acitvity wall only displays posts. It works great on the activity page BUT when I go under reading options and diplay it as the front page the function wont work? It's displayed as static front page

Why?

Here is my code

<?php


function show_activity_update()
{
if(is_page('activity'))
{
echo '<style>ul#activity-stream li.groups , ul#activity-stream li.blogs , ul#activity-stream li.members , ul#activity-stream li.xprofile , ul#activity-stream li.friends {display:none;}</style>';
}
}
add_action('wp_head','show_activity_update');

?>

Solutions

Replace is_page condition with is_front_page

try this:

<?php
function show_activity_update()
{
if(is_front_page())
{
echo '<style>ul#activity-stream li.groups , ul#activity-stream li.blogs , ul#activity-stream li.members , ul#activity-stream li.xprofile , ul#activity-stream li.friends {display:none;}</style>';
}
}
add_action('wp_head','show_activity_update');

?>
Tags: PHP / Wordpress

Similar questions

CSS styling won't work on php function. (Wordpress)
I can't get CSS styling to work on content returned from a wordpress php function: The CSS style will work for anything before or after the php for excerpt, but the excerpt itself refuses to be styled. The only way I seem to have any success is where I try to place the php inside the span tag, which hardly seems correct, and creates a new single-sp...
Javascript function in wordpress page won't work
I have made a script that takes a year as parameter and then prints out the difference from current year in words. The word part I haven't done myself, I found a bit of code that worked which I used. When I try the code in for example jsfiddle and call it with and it works when I use this HTML code. But when I try to run it within a Wordpress page ...
My custom stylesheet enqueue function won't work
I've been following a tutorial online thats taught me how to enqueue stylesheets for Wordpress with the functions folder instead of the headerusing the following code: Followed by: This has worked, but when I tried to enqueue a separate stylesheet for a page template, it won't work. Here is the code I used, I put it between the two above: I have a ...
Wordpress: Stripos function won't work on a curl result
I'm trying to use stripos on a curl result to check for a specific word. When I upload this code in my functions.php file, my wordpress website breaks down. The problem seems to come from the stripos function.
WordPress: do_action won't work in ajax callback function
I want to perform some actions when ajax tasks done successfully. For instance, if the item added to the cart, I want to send an email. Also may perform a few more actions. Setting up do_action('prefix_item_added_to_cart', $args); doesn't recognized and so add_action doesn't perform a task, in my case sending email. If I write code procedural code ...
Not Found when using activity stream as front page with BuddyPress
I'm trying to create a Thematic child theme that uses BuddyPress. First, I tried using BuddyMatic -- which currently doesn't work with WP3. Next, I tried the BuddyPress compatibility pack -- which totally works! Except for one thing: when I select "Activity Feed" as an option for the front page, I get a Not Found error. Going to /activity/, /groups...

Also ask

We use cookies to deliver the best possible experience on our website. By continuing to use this site, accepting or closing this box, you consent to our use of cookies. To learn more, visit our privacy policy.