Skip to:
Content
Pages
Categories
Search
Top
Bottom

BBPress Forums to Subdomain (included with domain)

Viewing 5 replies - 1 through 5 (of 5 total)
  • @netweb

    Keymaster

    This cannot be done at this stage…

    The only way I can think of doing this would be to install WordPress as forums.gamingtracks.com and then you would have URL’s like this:

    http://forums.gamingtracks.com/forums/topic/bbpress-forums-to-subdomain-included-with-domain/

    @inspirationally

    Participant

    I just installed my forum at http://mydomain.com/forums, which is the same as http://myseconddomain.com/forums – and used

    1. the multidomain plugin https://wordpress.org/plugins/multidomain/

    2. templates and menus based on the domain you see – this includes a different index loop file and different custom menu.

    This also works with subdomains.

    Here the code of index.php:

    <?php
    /**
     * The main template file.
     *
     * This is the most generic template file in a WordPress theme
     * and one of the two required files for a theme (the other being style.css).
     * It is used to display a page when nothing more specific matches a query. 
     * E.g., it puts together the home page when no home.php file exists.
     * Learn more: https://codex.wordpress.org/Template_Hierarchy
     *
     * @package WordPress
     * @subpackage Twenty_Ten
     * @since Twenty Ten 1.0
     */
    
    get_header(); ?>
    
    <?php if ( $_SERVER['SERVER_NAME'] == 'mydomain.com' ) { ?>
    
    			<?php
    			/* Run the loop to output the posts.
    			 * If you want to overload this in a child theme then include a file
    			 * called loop-index.php and that will be used instead.
    			 */
    
    			 get_template_part( 'loop', 'index-mydomain' );
    			?>
    <?php } elseif ( $_SERVER['SERVER_NAME'] == 'myseconddomain.com' || $_SERVER['SERVER_NAME'] == 'sub.mydomain.com'  ) { ?>
    
    			<?php
    			/* Run the loop to output the posts.
    			 * If you want to overload this in a child theme then include a file
    			 * called loop-index.php and that will be used instead.
    			 */
    
    			 get_template_part( 'loop', 'index-myseconddomain' );
    			?>			
    <?php } ?>
    
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>
    

    Then there is loop for the main site, and one for the forum including the forum overview.

    In the header I have

    <?php if ( $_SERVER['SERVER_NAME'] == 'mydomain.com ) { ?>
    <?php wp_nav_menu( array('container_class' => 'menu','menu' => 'Mydomain.org' )); ?>
    <?php } elseif ( $_SERVER['SERVER_NAME'] == 'myseconddomain.com' || $_SERVER['SERVER_NAME'] == 'sub.mydomain.com'  ) { ?>
    <?php wp_nav_menu( array('container_class' => 'menu','menu' => 'Myseconddomain.com' )); ?>
    <?php } ?>
    

    (the same for sidebar widgets etc.)

    Of course you could work with special forum templates for the forum sites.

    (real example see johnny-depp.org/deppheads.com)

    I think, I will have to add some kind of rewrite to not have duplicate content in the future.

    @netweb

    Keymaster

    @inspirationally Nice, I didn’t really think about doing things this way even though I’ve been debugging WordPress Multisite’s the past couple of days.

    Your way uses a single WordPress site with multiple domains and it looks like that works quite well for your use case.

    Another way would be to go WordPress Multisite using sub domains, your primary site would be http://example.com and with an extra site created using a sub-domain install at http://forums.example.com

    So overall it looks like there is a few different ways to achieve the end goal and it’s just a matter of now working out which option is best for your use case.

    @inspirationally

    Participant

    I thought, multisite is a bit too much when everything else (themes) is the same –
    also, I wanted to use the “topics to posts” plugin, and this was (after some research) not possible with multisite – this was the main reason.

    @gamingtracks

    Participant

    Thanks inspirationally

Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.
Skip to toolbar