This is an overview of how to add or re-arrange sidebar boxes in Flexible Squares. It will override the function print_sidebar()
. This requires the creation of a theme layer. If you already have a theme layer, you will need to edit it and add the code below. If you do not have a theme layer, you will need to create one by following the instructions in the Theme Layer tutorial.
Adding sidebar boxes
To add a box to the bottom of the sidebar you will need to insert the following code into your theme layer, making sure to copy everything:
function print_sidebar() { var string header; var string text; sidebar_order($*sidebar_order_1); sidebar_order($*sidebar_order_2); sidebar_order($*sidebar_order_3); sidebar_order($*sidebar_order_4);$header = """<li class="sbartitle">Your Header</li>"""; $text = """<li class="sbaritem"> Your text/HTML here </li>"""; print_sidebar_box($header, $text);}
Change "Your Header" to whatever you wish your header to be and add the contents of your box in the indicated place.
You can add as many new boxes as you wish by repeating the code highlighted in orange.
Displaying sidebar boxes on certain view types
The sidebar boxes will normally appear on all the views of your journal. However, if you wish the sidebar to have different boxes depending on the page type or if you simply don't wish to clutter other pages, you can select where you would like the sidebar box to appear. You can choose one of the following view types: recent, friends, archive, month, day, entry, reply. For the explanations of what each view is, please see the overview of S2 View Types.
The following code adds a sidebar box to display only on your Recent entries page. Again make sure to copy everything. Replace recent
with one of the view types listed above if you wish it to display on a different view type.
function print_sidebar() { var string header; var string text; var Page p = get_page(); sidebar_order($*sidebar_order_1); sidebar_order($*sidebar_order_2); sidebar_order($*sidebar_order_3); sidebar_order($*sidebar_order_4);if ($p.view == "recent") { $header = """<li class="sbartitle">Your Header</li>"""; $text = """<li class="sbaritem"> Your text/HTML here </li>"""; } print_sidebar_box($header, $text);}
Rearranging sidebar boxes
In Flexible Squares, the order of the sidebar boxes is determined by the properties which you can set on the Customize page. However, in these settings it is not possible to change the position of any boxes which you add on. Should you wish to do it, you will need to use the following code and rearrange the lines that start with "print_sidebar_
", but be sure to keep the code in orange together. Note that if you use this code, you will no longer be able to change the order in the settings on the Customize page.
function print_sidebar() { var string header; var string text; print_userpic(); print_sidebar_blurb(); print_sidebar_linklist(); print_sidebar_calendar();$header = """<li class="sbartitle">Your Header</li>"""; $text = """<li class="sbaritem"> Your text/HTML here </li>"""; print_sidebar_box($header, $text);}
Compile your layer, and it's ready to use. You will need to apply your theme layer via the Customize interface in order for your changes to take effect.
Contributed by </a></b></a>camomiletea.