Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class nggHeaderBG extends WP_Widget {
- function widget( $args, $instance ) {
- global $wpdb;
- $items = $instance['items'];
- $exclude = $instance['exclude'];
- $list = $instance['list'];
- $exclude_list = "AND t.gid IN ($list)";
- $imageList = $wpdb->get_results("SELECT t.*, tt.* FROM $wpdb->nggallery AS t INNER JOIN $wpdb->nggpictures AS tt ON t.gid = tt.galleryid WHERE tt.exclude != 1 $exclude_list ORDER by rand() limit {$items}");
- foreach($imageList as $image) {
- // get the URL constructor
- $image = new nggImage($image);
- /* CVC just create the URL */
- $out .= '' . home_url() . '/' . 'index.php?callback=image&pid='.$image->pid.'&width='.$instance['width'].'&height='.$instance['height'];
- echo $out;
- }
- }
- }// end widget class
- function nggDisplayRandomCSSBG($number, $width, $height, $exclude, $list, $show) {
- $options = array( 'title' => false,
- 'items' => 1,
- 'show' => 'original',
- 'type' => 'random',
- 'width' => $width,
- 'height' => $height,
- 'exclude' => 'allow',
- 'list' => $list,
- 'webslice' => false );
- $ngg_widget = new nggHeaderBG();
- $ngg_widget->widget($args = array( 'widget_id'=> 'sidebar_1' ), $options);
- }
- // Writes the style property for the header image background
- function cvcRandomBG(){
- if (in_array( 'nextgen-gallery/nggallery.php', apply_filters( 'active_plugins', get_option('active_plugins')))) {
- if (is_page_template('landing-page-wvup.php')){
- if (is_page( 'alumni-giving' )){
- ?> style='background-image: url(<?php nggDisplayRandomCSSBG(1,880,350,allow,3);?>);'<?
- }else{
- ?> style='background-image: url(<?php nggDisplayRandomCSSBG(1,880,350,allow,2);?>);'<?
- }
- }else{
- ?> style='background-image: url(<?php nggDisplayRandomCSSBG(1,880,250,allow,1);?>);'<?
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement