Integration:WPG2 Operations - Sidebar - Gallery Codex
Personal tools

Integration:WPG2 Operations - Sidebar

From Gallery Codex

This Page Relates to WPG2 Version 3.0


From Wordpress 2.2 onwards you can add your Gallery2 Content to your Wordpress sidebar from three included WPG2 widgets (Sidebar Album Tree, Sidebar Block, Sidebar Grid) via your Wordpress Widgets SubPanel. However, if your Wordpress theme is not widget-aware, you can still ad the functions of the widget to your sidebar by instead manually adding the function calls to your sidebar by following the installation instructions below.

Please Note: You must FIRST configure the various sidebar output options from WPG2 Options Sidebar Block and WPG2 Options Sidebar Grid.

Adding Gallery2 Output by Manually Editing the Sidebar

If you are unsure how to edit your sidebar, check out the wordpress lesson on editing the sidebar Here.

Manual Album Tree Installation

  • To have a clickable list of your Gallery2 Albums, listed as a (Collapsible, Sorted) Tree add the following code:
  • <?php print wpg2_make_html_album_tree()?>

Manual Sidebar Grid Block Installation

  • If you want to have a sidebar grid block (which is multiple images of one type, As per the settings on the WPG2 Sidebar Block Options tab), add the following code:
    <?php print g2_sidebargridblock(); ?>
  • You can also override the settings and freely define your own block settings by using the following code
  • <?php print g2_sidebargridblock(blocktype, number_of_images, blockmaximgsize, blocktitle); ?>
  • Where blocktype valid values limited to the following..
    • 'randomImage'
    • 'recentImage'
    • 'randomAlbum'
    • 'recentAlbum'
  • Where number_of_images is an integer that defines the number of images that will be included in this particular image gridblock.
  • Where blockmaximgsize is an integer that defines the maximum number of pixels that a thumbnail will occupy in either width or height. This can be larger than the pixel size of your Gallery2 thumbnails, but it will not increase the size of the thumbnail in this case.
  • Where blocktitle is the title that you want shown as a <h2> heading in the image gridblock.

Manual Sidebar Image Block Installation

  • If you want to have a single image sidebar block (either a single image of one type, or single images of several types which can be configured via the WPG2 Sidebar Options) add the following code:
    <?php print g2_sidebarimageblock(); ?>
  • If you want to display a specific image in the block, add the following code:
  • <?php print g2_sidebarimageblock(id); ?>
  • Where id is an integer representing the Gallery2 entity ID of the image or album you desire to display. If you choose an album, the highlight image for that album will be displayed.