The MU forums have moved to WordPress.org

How can I do this? (7 posts)

  1. Konstan
    Member
    Posted 15 years ago #

    I currently have around 45 themes and each of them has a custom header with links to a create blog, login, etc. Now I want to make it a little more dynamic in case I ever wanted to change it (like right now :P).

    I've searched but couldnt find any specific info on how to create something like <?php wp_head(); ?> that I can add to the themes where I want, something like <?php my_site_header(); ?> and have the my_site_header() funcion in a plugin file inside /mu-plugins/

    Or is there a simpler way?

  2. andrea_r
    Moderator
    Posted 15 years ago #

    hook into the footer. i know, it's the footer, but you can place stuff at the top of the page with it.

    Or, if it's a bar at the top, why not just use an already made plugin?
    http://wpmudevorg.wordpress.com/project/MU-Admin-Bar

  3. Konstan
    Member
    Posted 15 years ago #

    I looked over that and I think its too complicated for what I want to do. I'll see if I can butcher it down to make it simpler.

  4. dsader
    Member
    Posted 15 years ago #

    Here's what I do replace the menu in multiple themes:
    I have the following in an mu-plugin

    <?php function ds_header_menu() {
    echo '
    		<li class="page_item">Link</li>
    		<li class="page_item">Link</li>
    		<li class="page_item">Link</li>
    		<li class="page_item">Link</li>';
    	}
    ?>

    and the following in the header.php of each theme replacing the navigation div:

    <div id="nav">
    <ul class="nav">
    <?php ds_header_menu(); ?>
    </ul>
    </div>

    When I want to add or remove a link from the template menus of many themes, I edit one mu-plugin.

  5. Konstan
    Member
    Posted 15 years ago #

    Thats exacty what I was trying to do, thanks. It was simpler then I thought :)

    Also, where is the call that redirects all 404 to wp-sigup.php?new=?

    I changed wp-signup.php's name to another file, and the redirect isnt in the htaccess so I dont know where to look for that.

  6. dsader
    Member
    Posted 15 years ago #

    Would this work as an mu-plugin?

    <?php
    function ds_redirect_signup() {
    if (strpos($_SERVER['REQUEST_URI'], 'wp-signup.php?new=')){
    wp_redirect( "http://google.com" );
    }
    }
    add_action('signup_header', 'ds_redirect_signup');
    ?>

  7. Konstan
    Member
    Posted 15 years ago #

    EDIT:

    Found it, wpmu-settings.php at line 110:
    header( "Location: http://{$current_site->domain}{$current_site->path}wp-signup.php?new=" . urlencode( $blogname ) );

    Changing that seems to have fixed the redirect :) Now its working like it did when I had the old url :)

About this Topic