The MU forums have moved to WordPress.org

A Tutorial to Hardcode Sidebars (7 posts)

  1. wanderglobe.com
    Member
    Posted 14 years ago #

    Is there a tutorial available for hard coding sidebars for those of us who are new? Something that takes the code from an interesting plugin and places that in the sidebar.php file so that everyone sees it by default. This question seems to arise often and I'm surprised there isn't some kind of plugin that takes the admin sidebar settings and just makes that the default for all blog users.

    For example I want to have the login and search on sidebar2.php in the same place for all users and the Nextgen recent images and the recent global posts plugins on sidebar1.php for all users.

    The "New Blog Defaults" is a great plugin but it would be nice to see a switch that says "Use Admin Sidebars As Default For All New Blogs" if you know what I mean.

  2. htdev
    Member
    Posted 14 years ago #

    Yep, I'd also like to know this.

  3. dsader
    Member
    Posted 14 years ago #

    The plugin would depend on the markup in every template sidebar.php to be standard ex. <ul><li>stuff</li></ul>. Have a look at the markup in every theme you have, if it's all the same you are on your way. A one size fits all sidebar is impossible to release to public given the variety of theme html markup.

    http://codex.wordpress.org/Stepping_Into_Templates

    Best tutorial is to tinker with the themes you have. Code what works for you.

    For example, I use a sitewide footer, but I have had to tinker with a lot of themes to get it to display "just so". And I've had to avoid themes I couldn't fix. Releasing the plugin for all WP novices would be silly as custom coding is required.

    Secondly, each (many) widgets depend on options stored in that blog's db. Not a small feat to have every widget pull options from the main blog's widget. May be easier to add code to the functions.php of each template to set default options for a widget.

    What's a good way to proceed? Build your own my_sidear_block.php

    Then paste some include my_sidear_block.php line into every sidebar.php
    <?php include ( 'my_master_sidear_block.php'); ?>

  4. wanderglobe.com
    Member
    Posted 14 years ago #

    I understand where you're coming from regarding a plugin. It's just that I use only one theme so something like that would work for me. I've disabled appearance for all users. It's just one site, one theme and a few options like add post and add gallery.

    Thanks for the link and the reply.

  5. andrea_r
    Moderator
    Posted 14 years ago #

    Then hardcoding it (non-widgets) is the way to go. And that's the old-school plain ol' WordPress way to do it. :D

  6. kgraeme
    Member
    Posted 14 years ago #

    The mistake here is looking for a MU-specific solution. This is just basic wordpress theme design.

    If you're really lost with wordpress and the online tutorials and Codex pages are too complicated, then I recommend this book:
    http://www.amazon.com/WordPress-Theme-Design-complete-professional/dp/1847193099

  7. padma18885
    Member
    Posted 14 years ago #

    How to hardcode NextGen Gallery ?

About this Topic

  • Started 14 years ago by wanderglobe.com
  • Latest reply from padma18885