duannao3819 2014-05-12 10:41
浏览 29
已采纳

Buddypress - 功能不会在前面工作

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');

?>
  • 写回答

1条回答 默认 最新

  • dongxiang3648 2014-05-12 10:45
    关注

    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');
    
    ?>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?