Skip to:
Content
Pages
Categories
Search
Top
Bottom

Question about section in functions.php


  • Tracedef
    Participant

    @tracedef

    We’ve integrated BP into an existing theme we had and for some reason there is one section in the original BP functions.php we’ve imported into our existing theme’s functions.php that conflicts with the way our existing theme display our blog… essentially it breaks it. Our blog is in a /blog/ directory, not in the root, but that may not mean anything…. also BP is not in the root either it is at /community/ … if it helps at all, here’s a link http://tinyurl.com/bb726n

    If we remove the following from functions.php, what type of destruction and chaos can we expect? I’m not noticing anything out of the ordinary, but that doesn’t make me feel any better about taking this out…

    function bp_show_home_blog() {
    global $bp, $query_string;

    if ( $bp->current_component == HOME_BLOG_SLUG ) {
    $pos = strpos( $query_string, 'pagename=' . HOME_BLOG_SLUG );

    if ( $pos !== false )
    $query_string = preg_replace( '/pagename=' . HOME_BLOG_SLUG . '/', '', $query_string );

    query_posts($query_string);

    $single_check = strpos( $query_string, '&name=' );

    if ( $single_check === false )
    bp_core_load_template( 'index', true );
    else
    bp_core_load_template( 'single', true );
    }
    }
    add_action( 'wp', 'bp_show_home_blog', 2 );

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

  • John James Jacoby
    Keymaster

    @johnjamesjacoby

    Using that function would break your specific setup (which is nicely integrated now by the way.)

    It basically looks to see if where the user currently is, is within the HOME_BLOG_SLUG area. If so, it then checks to see if they’re looking at a index/category/archive setup, or if they’re viewing a single post.

    Since you have your main blog divided from the community how you do, and have some special routing of where things are and how to get there, I think you should be okay without this function.

    One thing I noticed however, is that your test blog uses a subdomain, where as the main blog uses a sub directory. This may be the next hurdle in your install to figure out, because I’ve yet to see a situation that handled both smoothly.


    Tracedef
    Participant

    @tracedef

    J.

    Good answer! Now I can get on to finding some other way to break stuff! Thanks for the help. :)


    John James Jacoby
    Keymaster

    @johnjamesjacoby

    You’re welcome! Good luck!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Question about section in functions.php’ is closed to new replies.
Skip to toolbar