[Support request] Image threshold error

Home Forums Support [Support request] Image threshold error

Home Forums Support Image threshold error

Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #1310844
    manaadiar

    Hi, i am getting this error when am trying to log in to my WP..

    Warning: Use of undefined constant ‘big_image_size_threshold’ – assumed ‘‘big_image_size_threshold’’ (this will throw an Error in a future version of PHP) in /home/harieshm/public_html/wp-content/themes/generatepress-child/functions.php on line 230

    Warning: Use of undefined constant ‘__return_false’ – assumed ‘‘__return_false’’ (this will throw an Error in a future version of PHP) in /home/harieshm/public_html/wp-content/themes/generatepress-child/functions.php on line 230

    Warning: Cannot modify header information – headers already sent by (output started at /home/harieshm/public_html/wp-content/themes/generatepress-child/functions.php:230) in /home/harieshm/public_html/alibaba.php on line 496

    #1310963
    David
    Staff
    Customer Support

    Hi there,

    those errors point to Functions in your child theme – you will need to correct or remove those functions.

    #1311000
    manaadiar

    Hi David, yes I can see that but can you advise

    1) what is the error and where..??
    2) why does it happen only intermittently..??

    How do I fix it..

    #1311135
    David
    Staff
    Customer Support

    What function have you in your Child Theme on line 230 ?

    #1311140
    manaadiar

    update_post_meta( $post_id, $key, $count );

    #1311820
    Tom
    Lead Developer
    Lead Developer

    Can you share the full function? Sounds like there’s a general PHP coding error.

    #1312027
    manaadiar

    Here you go Tom..

    
    <?php
    /**
     * GeneratePress child theme functions and definitions.
     *
     * Add your custom PHP in this file. 
     * Only edit this file if you have direct access to it on your server (to fix errors if they happen).
     */
    
    function generatepress_child_enqueue_scripts() {
    	if ( is_rtl() ) {
    		wp_enqueue_style( 'generatepress-rtl', trailingslashit( get_template_directory_uri() ) . 'rtl.css' );
    	}
    }
    add_action( 'wp_enqueue_scripts', 'generatepress_child_enqueue_scripts', 100 );
    
    //Insert ads after second paragraph of single post content.
    
    add_filter( 'the_content', 'prefix_insert_post_ads' );
     
    function prefix_insert_post_ads( $content ) {
         
        $ad_code = '<div>
    [the_ad id="114308"]
    </div><br>';
     
        if ( is_single() && ! is_admin() ) {
            return prefix_insert_after_paragraph( $ad_code, 5, $content );
        }
         
        return $content;
    }
      
    // Parent Function that makes the magic happen
      
    function prefix_insert_after_paragraph( $insertion, $paragraph_id, $content ) {
        $closing_p = '</p>';
        $paragraphs = explode( $closing_p, $content );
        foreach ($paragraphs as $index => $paragraph) {
     
            if ( trim( $paragraph ) ) {
                $paragraphs[$index] .= $closing_p;
            }
     
            if ( $paragraph_id == $index + 1 ) {
                $paragraphs[$index] .= $insertion;
            }
        }
         
        return implode( '', $paragraphs );
    }
    
    // Code to move cat/tags/comments to the top of the page - original deleted from post-meta.php
    
    if ( ! function_exists( 'generate_post_meta' ) ) {
    	add_action( 'generate_after_entry_title', 'generate_post_meta' , 'generate_after_entry_content', 'generate_footer_meta' );
    	/**
    	 * Build the post meta.
    	 *
    	 * @since 1.3.29
    	 */
    	function generate_post_meta() {
    		if ( 'post' == get_post_type() ) : ?>
    			<div class="entry-meta">
    				<?php generate_posted_on(); ?>
    			
    				<?php
    				generate_entry_meta();
    
    				?>
    			Estimated reading time = <?php echo reading_time(); ?>	
    				
    		<?php endif;
    	}
    }
    
    // Code to show the next and previous post - original deleted from post-meta.php
    
    if ( ! function_exists( 'generate_footer_meta' ) ) {
    	add_action( 'generate_after_entry_content', 'generate_footer_meta' );
    	/**
    	 * Build the footer post meta.
    	 *
    	 * @since 1.3.30
    	 */
    	function generate_footer_meta() {
    		if ( 'post' == get_post_type() ) : ?>
    			<footer class="entry-meta">
    				<?php
    			
    
    				if ( is_single() ) {
    					generate_content_nav( 'nav-below' );
    				}
    				?>
    				
    				
    				
    			</footer><!-- .entry-meta -->
    		<?php endif;
    	}
    }
    
    // Code to add reading time
    
    function reading_time() {
        $content = get_post_field( 'post_content', $post->ID );
        $word_count = str_word_count( strip_tags( $content ) );
        $readingtime = ceil($word_count / 200);
    
        if ($readingtime == 1) {
          $timer = " minute";
        } else {
          $timer = " minutes";
        }
        $totalreadingtime = $readingtime . $timer;
    
        return $totalreadingtime;
    }
    
    // Code to add Read More
    
    add_filter( 'wp_trim_excerpt', 'tu_excerpt_metabox_more' );
    function tu_excerpt_metabox_more( $excerpt ) {
    	$output = $excerpt;
    	
    	if ( has_excerpt() ) {
    		$output = sprintf( '%1$s <br><br><a href="%2$s">Go to full article >>></a>',
    			$excerpt,
    			get_permalink()
    		);
    	}
    	
    	return $output;
    }
    
    // Code to stop heartbeat
    
    add_action( 'init', 'stop_heartbeat', 1 );
    function stop_heartbeat() {
    wp_deregister_script('heartbeat');
    }
    
    // Adding EOA
    
    function auto_insert_after_post($content){
    if (is_single()) {
    $content .= '<b><p style="font-size:20px; color:#ffffff; background:#000000; text-align:center">*** End of Article ***</p></b>';
    }
    
    return $content;
    }
    add_filter( "the_content", "auto_insert_after_post" );
    
    // Code for Most Commented
    
    function wpb_most_commented_posts() { 
    // start output buffering
    ob_start();
    ?>
    <ul class="most-commented">
    <?php 
    // Run WP_Query
    // change posts_per_page value to limit the number of posts
    $query = new WP_Query('orderby=comment_count&posts_per_page=10'); 
     
    //begin loop
    while ($query->have_posts()) : $query->the_post(); ?>
     
    <li><a>" title="<?php the_title(); ?>"><?php the_title(); ?></a> <span class="wpb-comment-count"><?php comments_popup_link('No Comments;', '1 Comment', '% Comments'); ?></span></li>
    <?php endwhile; 
    // end loop
    ?>
    </ul>
    <?php
     
    // Turn off output buffering
     $output = ob_get_clean(); 
     
    //Return output 
    return $output; 
    }
    // Create shortcode
    add_shortcode('wpb_most_commented', 'wpb_most_commented_posts'); 
     
    //Enable shortcode execution in text widgets
    add_filter('widget_text', 'do_shortcode');
    
    // Code for Category list
    
    /**
     * This creates the [my_cat_list] shortcode and calls the
     * my_list_categories_shortcode() function.
     */
    add_shortcode( 'my_cat_list', 'my_list_categories_shortcode' );
    
    /**
     * this function outputs your category list where you
     * use the [my_cat_list] shortcode.
     */
    function my_list_categories_shortcode() {
        $args = array( 'echo'=>false );
        return wp_list_categories( $args ); 
    }
    
    // Code for post views
    
    function gt_get_post_view() {
        $count = get_post_meta( get_the_ID(), 'post_views_count', true );
        return "$count views";
    }
    
    function gt_set_post_view() {
        $key = 'post_views_count';
        $post_id = get_the_ID();
        $count = (int) get_post_meta( $post_id, $key, true );
        $count++;
        update_post_meta( $post_id, $key, $count );
    }
    
    function gt_posts_column_views( $columns ) {
        $columns['post_views'] = 'View(s)';
        return $columns;
    }
    
    function gt_posts_custom_column_views( $column ) {
        if ( $column === 'post_views') {
            echo gt_get_post_view();
        }
    
    }
    
    add_filter( 'manage_posts_columns', 'gt_posts_column_views' );
    add_action( 'manage_posts_custom_column', 'gt_posts_custom_column_views' );
    
    // filter by author
     
    function rudr_filter_by_the_author() {
    	$params = array(
    		'name' => 'author', // this is the "name" attribute for filter <select>
    		'show_option_all' => 'All authors' // label for all authors (display posts without filter)
    	);
     
    	if ( isset($_GET['user']) )
    		$params['selected'] = $_GET['user']; // choose selected user by $_GET variable
     
    	wp_dropdown_users( $params ); // print the ready author list
    }
     
    add_action('restrict_manage_posts', 'rudr_filter_by_the_author');
    
    // code to remove website url in comments
    
    add_filter('comment_form_default_fields', 'unset_url_field');
    function unset_url_field($fields){
        if(isset($fields['url']))
           unset($fields['url']);
           return $fields;
    }
    #1312885
    Tom
    Lead Developer
    Lead Developer

    I’m not seeing big_image_size_threshold in there at all.

    That error means you’ve added big_image_size_threshold without quotations around it somewhere. It should be 'big_image_size_threshold' or "big_image_size_threshold".

    #1312941
    manaadiar

    Hi Tom, then am not sure what’s happening because it is making reference to the functions.php.. I have checked in the parent theme as well, its not there.. And as i said, there is no pattern.. It didn’t appear when i logged in now, but it appeared when i logged in an hour ago.. Can it sit in the browser cache..??

    #1313312
    Tom
    Lead Developer
    Lead Developer

    I doubt it. What’s in the alibaba.php file?

    #1313539
    manaadiar

    Hi Tom, that is my custom admin login file – instead of wp-admin.php..

    #1314515
    Tom
    Lead Developer
    Lead Developer

    Hmm, I’m not sure then. Any server/plugin caching?

    Line 230 when I paste your code into my editor is just a closing }, so it doesn’t match up with the error at all.

    #1314664
    manaadiar

    Yes, not sure.. But since yday that error is not there.. It last came up maybe a month ago and then early this week when i posted it here.. Strange indeed.. I am closing this for now, will come back if it shows again..

    #1314861
    Tom
    Lead Developer
    Lead Developer

    Sounds good 🙂

Viewing 14 posts - 1 through 14 (of 14 total)
  • You must be logged in to reply to this topic.