Tagged: x
-
AuthorPosts
-
October 10, 2016 at 11:36 am #1210151
Bart971ParticipantHello, i’m writting you because when i visit my functions.php ie: http://site.com/wp-content/themes/x-child/functions.php
I’m getting this error:
Fatal error: Call to undefined function add_filter() in /home/xxxxx/public_html/wp-content/themes/x-child/functions.php on line 19i checked on line 19 and here is the code that is getting an error:
add_filter( 'x_enqueue_parent_stylesheet', '__return_true' );Here is my functions.php file:
<?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' ); // Buttons // ============================================================================= function x_shortcode_button2( $atts, $content = null ) { extract( shortcode_atts( array( 'id' => '', 'class' => '', 'style' => '', 'type' => '', 'shape' => '', 'size' => '', 'float' => '', 'block' => '', 'circle' => '', 'icon_only' => '', 'href' => '', 'title' => '', 'target' => '', 'info' => '', 'info_place' => '', 'info_trigger' => '', 'info_content' => '', 'lightbox_thumb' => '', 'lightbox_video' => '', 'lightbox_caption' => '' ), $atts, 'x_button' ) ); $id = ( $id != '' ) ? 'id="' . esc_attr( $id ) . '"' : ''; $class = ( $class != '' ) ? ' ' . esc_attr( $class ) : ''; $style = ( $style != '' ) ? 'style="' . $style . '"' : ''; $type = ( $type != '' ) ? ' x-btn-' . $type : ''; $shape = ( $shape != '' ) ? ' x-btn-' . $shape : ''; $size = ( $size != '' ) ? ' x-btn-' . $size : ''; switch ( $float ) { case 'left' : $float = ' alignleft'; break; case 'right' : $float = ' alignright'; break; default : $float = ''; } $block = ( $block == 'true' ) ? ' x-btn-block' : ''; $icon_only = ( $icon_only == 'true' ) ? ' x-btn-icon-only' : ''; $href = ( $href != '' ) ? $href : '#'; $title = ( $title != '' ) ? 'title="' . $title . '"' : ''; $target = ( $target == 'blank' ) ? 'target="_blank"' : ''; $lightbox_thumb = ( $lightbox_thumb != '' ) ? $lightbox_thumb : ''; $lightbox_video = ( $lightbox_video == 'true' ) ? ', width: 1080, height: 608' : ''; $lightbox_caption = ( $lightbox_caption != '' ) ? 'data-caption="' . $lightbox_caption . '"' : ''; $tooltip_attr = ( $info != '' ) ? cs_generate_data_attributes_extra( $info, $info_trigger, $info_place, '', $info_content ) : ''; if ( is_numeric( $lightbox_thumb ) ) { $lightbox_thumb_info = wp_get_attachment_image_src( $lightbox_thumb, 'full' ); $lightbox_thumb = $lightbox_thumb_info[0]; } if ( $lightbox_video != '' ) { $lightbox_options = "data-options=\"thumbnail: '" . $lightbox_thumb . "'{$lightbox_video}\""; } else { $lightbox_options = "data-options=\"thumbnail: '" . $lightbox_thumb . "'\""; } if ( $circle == 'true' ) { $output = "<div {$id} class=\"x-btn-circle-wrap{$size}{$block}{$float}\" {$style}><a rel=\"nofollow\" class=\"x-btn{$class}{$type}{$shape}{$size}{$block}{$icon_only}\" href=\"{$href}\" {$title} {$target} {$tooltip_attr} {$lightbox_caption} {$lightbox_options}>" . do_shortcode( $content ) . "</a></div>"; } else { $output = "<a {$id} rel=\"nofollow\" class=\"x-btn{$class}{$type}{$shape}{$size}{$block}{$float}{$icon_only}\" {$style} href=\"{$href}\" {$title} {$target} {$tooltip_attr} {$lightbox_caption} {$lightbox_options}>" . do_shortcode( $content ) . "</a>"; } return $output; } add_filter('init', function() { remove_shortcode( 'x_button' ); add_shortcode( 'x_button', 'x_shortcode_button2' ); }); function remove_inline_customizer_css () { remove_action( 'wp_head', 'x_customizer_generated_css_output', 9998); } add_action('after_setup_theme', 'remove_inline_customizer_css'); function remove_site_styles () { wp_dequeue_style( 'x-font-custom' ); // this line may not be necessary for all child themes wp_dequeue_style( 'x-font-standard' ); } add_action( 'wp_enqueue_scripts', 'remove_site_styles', 11 ); add_action( 'after_setup_theme', 'load_child_language' ); function load_child_language() { load_child_theme_textdomain( '__x__', get_stylesheet_directory() . '/languages' ); }Does the syntax is correct? Thanks in advance.
Best RegardsOctober 10, 2016 at 12:03 pm #1210175
JadeModeratorHi there,
I tried the code on my end and I am not getting the same error.
Please try the suggestion here.
October 10, 2016 at 12:33 pm #1210214
Bart971ParticipantThanks a lot for answering fast. I have little knowkledge regarding coding. I read the link you sent but I don’t understand. The guy talk about this:
defined( 'ABSPATH' ) || define( 'ABSPATH', __DIR__ . '/' ); require_once( ABSPATH . 'wp-settings.php' );but what should I do?
Thanks in Advance.
RegardsOctober 10, 2016 at 1:22 pm #1210291
RupokMemberHi there,
Your functions.php code seems fine and should not through such error. Where you are getting this error? I can’t see this error on your site.
Thanks!
-
AuthorPosts
- <script> jQuery(function($){ $("#no-reply-1210151 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>
