Loading scripts only if a particular shortcode or widget is present

You can use the function is_active_widget . E.g.: function check_widget() { if( is_active_widget( ”, ”, ‘search’ ) ) { // check if search widget is used wp_enqueue_script(‘my-script’); } } add_action( ‘init’, ‘check_widget’ ); To load the script in the page where the widget is loaded only, you will have to add the is_active_widget() code, in … Read more

Using Switch Statement to Change Image According to Last Digit of Topic ID

I would try something like this: function bg_image_topic_titlearea() { if ( ! function_exists( ‘bbp_get_topic_id’ ) ) { return false; } if ( ! $letztezifferimgs = bbp_get_topic_id() ) { return false; } $letztezifferimgs = substr( $letztezifferimgs, – 1 ); // switch … return true; } I would recommend checking to make sure the function call (bbp_get_topic_id();) … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)