I'm getting a fatal error? "Call to undefined method"
-
Last night I was tweaking a few things, as I’ve just moved from .com
As far as I could tell it was all working when I went to bed last night. I’ve just loaded my site up today and i’m receiving
Fatal error: Call to undefined method TC_post_thumbnails::tc_get_thumbnail_data() in /home1/k33k00/public_html/wp-content/themes/customizr Junior/functions.php on line 123
I’m running the customizr theme, with a child theme i’m creating myself. I’ve just removed the custom functions.php, and it works again, but without my slider.
The slider is from the customizr snippets, it pulls or was pulling when it worked. 5 recent posts and displaying them on my front page.
The site is, http://elitegrandiosity.com, if you need a look
Unfortunately i’m at work so can’t use pastebin so i’m going to have to post the code underneath.
<?php add_filter('tc_core', 'use_custom_slider_class'); function use_custom_slider_class($classes){ //don't instantiate default class unset( $classes['content'][ array_search(array('inc/parts','slider'), $classes['content']) ] ); //instantiate our class new TC_Slider_mod; return $classes; } add_filter('tc_slider_name_id', 'my_slider_of_posts'); function my_slider_of_posts( $slider_name_id ){ if ( $slider_name_id == 'recentposts' ) return array( 'slider' => 'recentposts', 'query' => array( //'tag' => "recentposts", 'posts_per_page' => 5, 'order' => 'desc' ) ); return $slider_name_id; } define('CUSTOMIZR', get_template_directory() ); require_once( CUSTOMIZR . '/inc/parts/class-content-slider.php'); class TC_Slider_mod extends TC_slider{ // override tc_get_slides function tc_get_slides($slider_name_id, $img_size){ if ( ! is_array($slider_name_id) ) return parent::tc_get_slides($slider_name_id, $img_size); // from here starts a slightly different version of the parent::tc_get_slides extract($slider_name_id); $all_sliders = tc__f('__get_option' , 'tc_sliders'); $saved_slides = ( isset($all_sliders[$slider]) ) ? $all_sliders[$slider] : false; //if the slider not longer exists or exists but is empty, return false if ( !isset($saved_slides) || !is_array($saved_slides) || empty($saved_slides) ) return; global $wp_query, $wp_the_query, $post; $wp_query = new WP_Query($query); // if you don't want to show the first attachment when featured image isn't set // remove the line below add_filter('tc_show_single_post_content', '__return_false'); // build our array of slides //initialize the slides array $slides = array(); //init slide active state index $i = 0; while ( have_posts() ){ the_post(); //title $title = $post->post_title; $default_title_length = apply_filters( 'tc_slide_title_length', 80 ); $title = ( strlen($title) > $default_title_length ) ? substr( $title,0,strpos( $title, ' ' , $default_title_length) ). ' ...' : $title; //lead text $text = get_the_excerpt(); $default_text_length = apply_filters( 'tc_slide_text_length', 250 ); $text = ( strlen($text) > $default_text_length ) ? substr( $text,0,strpos( $text, ' ' ,$default_text_length) ). ' ...' : $text; //button text $button_text = __('Read more »', 'customizr'); $default_button_length = apply_filters( 'tc_slide_button_length', 80 ); $button_text = ( strlen($button_text) > $default_button_length ) ? substr( $button_text,0,strpos( $button_text, ' ' ,$default_button_length)). ' ...' : $button_text; //link post id $link_id = get_the_id(); $id = $link_id; //button link $link_url = $link_id ? get_permalink( $link_id ) : 'javascript:void(0)'; //sets the first slide active $active = ( 0 == $i ) ? 'active' : ''; $color_style = ''; //attachment image $alt = apply_filters( 'tc_slide_background_alt' , trim(strip_tags( get_the_title() ) ) ); $slide_background = $this -> tc_get_thumbnail_data($img_size, $alt); //adds all values to the slide array only if the content exists (=> handle the case when an attachment has been deleted for example). Otherwise apply a default slide if ( empty($slide_background) ) $slide_background = wp_get_attachment_image( $saved_slides[1], $img_size, false, array( 'class' => 'slide' , 'alt' => $alt ) ); $slides[$id] = array( 'title' => $title, 'text' => $text, 'button_text' => $button_text, 'link_id' => $link_id, 'link_url' => $link_url, 'active' => $active, 'color_style' => $color_style, 'slide_background' => $slide_background, ); //increments active index $i++; }//end of slides loop // if you chose to not show the first attachment when featured image isn't set // remove the line below remove_filter('tc_show_single_post_content', '__return_false'); $wp_query = $wp_the_query; //returns the slides or false if nothing return ( !empty($slides) ) ? $slides : false; } function tc_get_thumbnail_data($img_size, $alt){ $attachment_id = get_post_meta( get_the_ID(), 'slide_img'); if ( $attachment_id ) return wp_get_attachment_image( $attachment_id[0], $img_size, false, array('class' => 'slide' , 'alt' => $alt) ); return TC_post_thumbnails::$instance -> tc_get_thumbnail_data($img_size)[0]; } }
- The topic ‘I'm getting a fatal error? "Call to undefined method"’ is closed to new replies.