Results 1 to 3 of 3

Thread: PHP Division by Zero Error in functions.php

  1. #1
    Thread Starter
    kdubose's Avatar
    Join Date
    Sep 2011
    Location
    United States
    Posts
    168
    Thanks
    3
    Thanked 2 Times in 2 Posts

    PHP Division by Zero Error in functions.php

    Here is my functions.php file. The error is being reported on the last line of the code where I am setting the default time zone. Can you tell me if there is indeed something wrong here? Thanks!
    http://marketplace.bakkenshale.com

    PHP Code:
    <?php
    /**
     * Theme functions file
     *
     * DO NOT MODIFY THIS FILE. Make a child theme instead: http://codex.wordpress.org/Child_Themes
     *
     * @package ClassiPress
     * @author AppThemes
     */

    global $cp_options;

    // current version
    $app_theme 'ClassiPress';
    $app_abbr 'cp';
    $app_version '3.3';
    $app_db_version 1960;
    $app_edition 'Ultimate Edition';

    // define rss feed urls
    $app_rss_feed 'http://feeds2.feedburner.com/appthemes';
    $app_twitter_rss_feed 'http://api.twitter.com/1/statuses/user_timeline.rss?screen_name=appthemes';
    $app_forum_rss_feed 'http://forums.appthemes.com/external.php?type=RSS2';

    // define the transients we use
    $app_transients = array($app_abbr.'_cat_menu');

    define'APP_TD''classipress' );

    // Framework
    require_once( dirname__FILE__ ) . '/framework/load.php' );

    // Payments
    require_once( dirname__FILE__ ) . '/includes/payments/load.php' );

    // Options
    require_once( dirname__FILE__ ) . '/includes/theme-options.php' );

    scb_register_table'app_pop_daily'$app_abbr '_ad_pop_daily' );
    scb_register_table'app_pop_total'$app_abbr '_ad_pop_total' );
    APP_Mail_From::init();

    require_once( 
    dirname__FILE__ ) . '/framework/includes/stats.php' );

    if ( 
    is_admin() )
        require_once( 
    dirname__FILE__ ) . '/framework/admin/importer.php' );

    // Theme-specific files
    require_once( dirname__FILE__ ) . '/includes/theme-functions.php' );

    // Start MultiPort Slider
    if ( !function_exists('cp_ad_featured_thumbnail') ) :
        function 
    cp_ad_featured_thumbnail() {
            global 
    $post$cp_options;

            
    // go see if any images are associated with the ad
            
    $image_id cp_get_featured_image_id($post->ID);

            
    // set the class based on if the hover preview option is set to "yes"
            
    $prevclass = ( $cp_options->ad_image_preview ) ? 'preview' 'nopreview';

            if ( 
    $image_id ) {

                
    // get images for MultiPort
                
    $adthumbarray wp_get_attachment_image($image_id'featured-thumbnail');

                
    // grab the large image for onhover preview
                
    $adlargearray wp_get_attachment_image_src($image_id'large');
                
    $img_large_url_raw $adlargearray[0];

                
    // must be a v3.0.5+ created ad
                
    if($adthumbarray) {
                    echo 
    '<a href="'get_permalink() .'" title="'the_title_attribute('echo=0') .'" class="'.$prevclass.'" data-rel="'.$img_large_url_raw.'">'.$adthumbarray.'</a>';

                
    // maybe a v3.0 legacy ad
                
    } else {
                    
    $adthumblegarray wp_get_attachment_image_src($image_id'thumbnail');
                    
    $img_thumbleg_url_raw $adthumblegarray[0];
                    echo 
    '<a href="'get_permalink() .'" title="'the_title_attribute('echo=0') .'" class="'.$prevclass.'" data-rel="'.$img_large_url_raw.'">'.$adthumblegarray.'</a>';
                }

            
    // no image so return the placeholder thumbnail
            
    } else {
                echo 
    '<a href="' get_permalink() . '" title="' the_title_attribute('echo=0') . '"><img class="attachment-featured-thumbnail" alt="" title="" src="' appthemes_locate_template_uri('images/no-thumb.jpg') . '" /></a>';
            }

        }
    endif;

    // setup different image sizes
    if ( function_exists'add_image_size' ) ) {
    add_image_size('blog-thumbnail'150150); // blog post thumbnail size, box crop mode
    add_image_size('sidebar-thumbnail'5050true); // sidebar blog thumbnail size, box crop mode
    add_image_size('featured-thumbnail'140105true); // featured slider thumbnail size, box crop mode

    // create special sizes for the ads
    add_image_size('ad-thumb'7575true);
    add_image_size('ad-small'100100true);
    add_image_size('ad-medium'250250true);
    //add_image_size('ad-large', 500, 500);
    }
    // End MultiPort Slider

    //Per Post Custom CSS
    add_action('admin_menu''bb_custom_css_hooks');
    add_action('save_post''bb_save_custom_css');
    add_action('wp_head','bb_insert_custom_css');
    function 
    bb_custom_css_hooks() {
            
    add_meta_box('custom_css''Custom CSS''custom_css_input''post''normal''high');
            
    add_meta_box('custom_css''Custom CSS''custom_css_input''page''normal''high');
    }
    function 
    custom_css_input() {
            global 
    $post;
            echo 
    '<input type="hidden" name="custom_css_noncename" id="custom_css_noncename" value="'.wp_create_nonce('custom-css').'" />';
            echo 
    '<textarea name="custom_css" id="custom_css" rows="5" cols="30" style="width:100%;">'.get_post_meta($post->ID,'_custom_css',true).'</textarea>';
    }
    function 
    bb_save_custom_css($post_id) {
            if (!
    wp_verify_nonce($_POST['custom_css_noncename'], 'custom-css')) return $post_id;
            if (
    defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) return $post_id;
            
    $custom_css $_POST['custom_css'];
            
    update_post_meta($post_id'_custom_css'$custom_css);
    }
    function 
    bb_insert_custom_css() {
            if (
    is_page() || is_single()) {
                    if (
    have_posts()) : while (have_posts()) : the_post();
                            echo 
    '<style type="text/css">'.get_post_meta(get_the_ID(), '_custom_css'true).'</style>';
                    endwhile; endif;
                    
    rewind_posts();
            }
    }

    date_default_timezone_set(America/Chicago);

  2. #2
    samcy's Avatar
    Join Date
    Mar 2012
    Location
    Germany
    Posts
    12,098
    Thanks
    121
    Thanked 1,756 Times in 1,442 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!
    Rolf Hassel (Samcy)

  3. #3
    Thread Starter
    kdubose's Avatar
    Join Date
    Sep 2011
    Location
    United States
    Posts
    168
    Thanks
    3
    Thanked 2 Times in 2 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] "Division by zero" error
    By abetts in forum Slider Ultimate
    Replies: 4
    Last Post: October 21st, 2013, 07:54 AM
  2. [SOLVED] Child functions.php error
    By rlawrie in forum ClassiPress General Discussion
    Replies: 4
    Last Post: September 12th, 2013, 01:42 PM
  3. PHP Warning: Division by zero in theme-functions.php on line 1630
    By localsurf in forum Help Using ClassiPress
    Replies: 3
    Last Post: October 6th, 2012, 09:01 AM
  4. error functions.php
    By dphr in forum Report JobRoller Bugs
    Replies: 2
    Last Post: March 23rd, 2012, 05:06 PM
  5. [SOLVED] Help! ERROR: PHP Warning: Division by zero in theme-functions.php on line 1630
    By queimadeofertas in forum Help Using ClassiPress
    Replies: 7
    Last Post: December 21st, 2011, 07:34 AM