Fatal Error After Most Recent Update

Hi X Theme Support!

I just updated the theme on my site and got this error:

Fatal error: Call to undefined function csl18n() in /home/gratef97/public_html/gratefulsolutions/wp-content/themes/x-child/functions.php on line 103

Any help would be appreciated.

Cheers!

Hello @Shenizee,

Thanks for asking. :slight_smile:

Error code points to some custom code in child theme function.php file that is causing the issue. Can you please share the contents of child theme function.php file with us, so we can take a closer look?

Thanks.

Here’s the child theme, function php content.

Please let me know if there’s an easier way to share this with you. Thanks!

<?php // ============================================================================= // FUNCTIONS.PHP // ----------------------------------------------------------------------------- // Overwrite or add your own custom functions to X in this file. // ============================================================================= // ============================================================================= // TABLE OF CONTENTS // ----------------------------------------------------------------------------- // 01. Enqueue Parent Stylesheet // 02. Additional Functions // ============================================================================= // Enqueue Parent Stylesheet // ============================================================================= add_filter( 'x_enqueue_parent_stylesheet', '__return_true' ); // Additional Functions // ============================================================================= // ============================================================================= // Custom Excerpt Length - Call: echo excerpt($length); // ============================================================================= function excerpt($limit) { $excerpt = explode(' ', get_the_excerpt(), $limit); if (count($excerpt)>=$limit) { array_pop($excerpt); $excerpt = implode(" ",$excerpt).'.'; } else { $excerpt = implode(" ",$excerpt); } // $excerpt = preg_replace('\[[^\]]*\]','',$excerpt); return $excerpt; } // ============================================================================= // Add Excerpt to Recent Posts -> [x_recent_posts] // ============================================================================= function x_shortcode_recent_posts_excerpt( $atts ) { extract( shortcode_atts( array( 'id' => '', 'class' => '', 'style' => '', 'type' => 'post', 'count' => '', 'category' => '', 'offset' => '', 'orientation' => '', 'no_image' => '', 'fade' => '' ), $atts, 'x_recent_posts' ) ); $allowed_post_types = apply_filters( 'cs_recent_posts_post_types', array( 'post' => 'post' ) ); $type = ( isset( $allowed_post_types[$type] ) ) ? $allowed_post_types[$type] : 'post'; $id = ( $id != '' ) ? 'id="' . esc_attr( $id ) . '"' : ''; $class = ( $class != '' ) ? 'x-recent-posts cf ' . esc_attr( $class ) : 'x-recent-posts cf'; $style = ( $style != '' ) ? 'style="' . $style . '"' : ''; $count = ( $count != '' ) ? $count : 3; $category = ( $category != '' ) ? $category : ''; $category_type = ( $type == 'post' ) ? 'category_name' : 'portfolio-category'; $offset = ( $offset != '' ) ? $offset : 0; $orientation = ( $orientation != '' ) ? ' ' . $orientation : ' horizontal'; $no_image = ( $no_image == 'true' ) ? $no_image : ''; $fade = ( $fade == 'true' ) ? $fade : 'false'; $js_params = array( 'fade' => ( $fade == 'true' ) ); $data = cs_generate_data_attributes( 'recent_posts', $js_params ); $output = "
"; $q = new WP_Query( array( 'orderby' => 'date', 'post_type' => "{$type}", 'posts_per_page' => "{$count}", 'offset' => "{$offset}", "{$category_type}" => "{$category}", 'ignore_sticky_posts' => true ) ); if ( $q->have_posts() ) : while ( $q->have_posts() ) : $q->the_post(); if ( $no_image == 'true' ) { $image_output = ''; $image_output_class = 'no-image'; } else { $image = wp_get_attachment_image_src( get_post_thumbnail_id(), 'entry-cropped' ); $bg_image = ( $image[0] != '' ) ? ' style="background-image: url(' . $image[0] . ');"' : ''; $image_output = '
'; $image_output_class = 'with-image'; } $output .= '' . '' . '
' . $image_output . '
' . '

' . get_the_title() . '

' . '' . get_the_date() . '' . do_shortcode('[x_gap size="10px"]') . '' . strip_tags(excerpt(25)) . '' . '
' . '
' . '' . '
'; endwhile; endif; wp_reset_postdata(); $output .= '
'; return $output; } add_action('wp_head', 'update_x_recent_posts_to_v2'); function update_x_recent_posts_to_v2() { remove_shortcode( 'x_recent_posts' ); add_shortcode( 'x_recent_posts', 'x_shortcode_recent_posts_excerpt' ); }

I have the same Problem…

Hi, Shenizee,

this function is not supported in newer versions of X and Xpro! You should use Display Posts Shortcode to realize recent posts. It´s a little tricky, but works well…and you will use it for other Projects.

Cheers,
Cyrock

1 Like

Thanks for helping out, Cyrock.

Thanks, Cyrock!

For not just pointing out what’s wrong but also providing the solution.

Cheers!