Support » Plugin: WP Accessibility » the plugin only works in the home page?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Joe Dolson

    (@joedolson)

    There’s a JS file called ‘custom_news.js’ that’s throwing a TypeError on your interior pages. The script runs fine on the main page, but it may be breaking other scripts on the interior pages. You may want to investigate that; I don’t know what the script is coming from, but if you disable that plug-in and things work normally afterwards, then that’s the problem.

    Hi Joe , since I only have access to the admin panel , I cant see the script itself , but its a theme script not a plugin script , so I have tried to use the wordpress -dequeue_script() function in function.php , but it didnt solve the problem…with home page vs inner pages.

    do you have any idea what else can be wrong?

    I have a child theme , and this is the code that calls the script in function.php.
    I have tried to delete this code , and what happened is that , WP Accessibility stopped working also in the home page , can you see somthing in the code that can cause this…

    <?php
    
    /** Custom Functions */
    
    /* Add class to wpcf7 form */
    add_filter( 'wpcf7_form_class_attr', 'prefix_form_class_attr' );
    function prefix_form_class_attr( $class ) {
    $class .= ' prefix-wpcf7-form';
    return $class;
    }
    function wptuts_scripts_basic()
    {
        	wp_register_script( 'custom-news', get_template_directory_uri() . '/js/custom_news.js' );
       	wp_enqueue_script( 'custom-news' );
    }
    add_action( 'wp_enqueue_scripts', 'wptuts_scripts_basic' );
    
    function show_scroll_news_shortcode($atts) {
    	$arr = array(
            'title' => 'News',
        );
        $a = shortcode_atts($arr,$atts);
        $title = $a['title'];
    
        $html = '<h4 class="sidebar-widget-title ui--widget-title">';
        $html .= '<span>' . $title . '</span>';
        $html .= '</h4>';
    
        $html .= '<div class="scroll_news_container">';
    
    	global $post;
    	$posts = new WP_Query();
    	$posts->query('post_type=scroll_news&showposts=-1');
    	if($posts->found_posts > 0) {
    			$html .= '<div id="scroll_news"><ul>';
    			while ($posts->have_posts()) {
    				$posts->the_post();
    				$title = get_the_title($post->ID);
    				$custom_link = get_field("custom_link");
     				$new_window = get_field("new_window");
    
     				if ($new_window) {
    					$html .= '<li class="single_new"><a target="_blank" href="' . $custom_link . '">' . $title . '</a></li>';
    				}
    				else {
    					$html .= '<li class="single_new"><a href="' . $custom_link . '">' . $title . '</a></li>';
    				}
    			}
    			$html .= '</ul></div>';
    			wp_reset_postdata();
    	}
    
        $html .= '</div>';
    
        $html .= '<input type="button" id="scroll-pause" class="playing" />';
    
    	return $html;
    }
    add_shortcode("scroll_news","show_scroll_news_shortcode");
    
    // Register Custom Post Type
    function scroll_news() {
    
    	$labels = array(
    		'name'                => _x( 'Scroll News', 'Post Type General Name', 'scroll_news' ),
    		'singular_name'       => _x( 'Scroll New', 'Post Type Singular Name', 'scroll_news' ),
    		'menu_name'           => __( 'Scroll News', 'scroll_news' ),
    		'parent_item_colon'   => __( 'Parent Item:', 'scroll_news' ),
    		'all_items'           => __( 'All Items', 'scroll_news' ),
    		'view_item'           => __( 'View Item', 'scroll_news' ),
    		'add_new_item'        => __( 'Add New Item', 'scroll_news' ),
    		'add_new'             => __( 'Add New', 'scroll_news' ),
    		'edit_item'           => __( 'Edit Item', 'scroll_news' ),
    		'update_item'         => __( 'Update Item', 'scroll_news' ),
    		'search_items'        => __( 'Search Item', 'scroll_news' ),
    		'not_found'           => __( 'Not found', 'scroll_news' ),
    		'not_found_in_trash'  => __( 'Not found in Trash', 'scroll_news' ),
    	);
    	$args = array(
    		'labels'              => $labels,
    		'supports'            => array( 'title', ),
    		'hierarchical'        => false,
    		'public'              => true,
    		'show_ui'             => true,
    		'show_in_menu'        => true,
    		'show_in_nav_menus'   => true,
    		'show_in_admin_bar'   => true,
    		'menu_position'       => 5,
    		'can_export'          => false,
    		'has_archive'         => false,
    		'exclude_from_search' => true,
    		'publicly_queryable'  => true,
    		'capability_type'     => 'page',
    	);
    	register_post_type( 'scroll_news', $args );
    
    }
    
    // Hook into the 'init' action
    add_action( 'init', 'scroll_news', 0 );
    
    ?>

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘the plugin only works in the home page?’ is closed to new replies.