get( 'posts_per_page' ); $comments_per_page = get_option( 'comments_per_page' ); $js_object = array( /* General */ 'templateUrl' => GRAPHENE_ROOTURI, 'isSingular' => is_singular(), /* Comments */ 'shouldShowComments' => graphene_should_show_comments(), 'commentsOrder' => get_option( 'default_comments_page' ), /* Slider */ 'sliderDisable' => $graphene_settings['slider_disable'], 'sliderAnimation' => $graphene_settings['slider_animation'], 'sliderTransSpeed' => $graphene_settings['slider_trans_speed'], 'sliderInterval' => $graphene_settings['slider_speed'], 'sliderDisplay' => $graphene_settings['slider_display_style'], /* Infinite Scroll */ 'infScroll' => $graphene_settings['inf_scroll_enable'], 'infScrollClick' => $graphene_settings['inf_scroll_click'], 'infScrollComments' => $graphene_settings['inf_scroll_comments'], 'totalPosts' => $wp_query->found_posts, 'postsPerPage' => $posts_per_page, 'isPageNavi' => function_exists( 'wp_pagenavi' ), 'infScrollMsgText' => sprintf( __( 'Fetching %1$s more item from %2$s left ...', 'graphene' ), 'window.grapheneInfScrollItemsPerPage', 'window.grapheneInfScrollItemsLeft' ), 'infScrollMsgTextPlural'=> sprintf( _n( 'Fetching %1$s more item from %2$s left ...', 'Fetching %1$s more items from %2$s left ...', $posts_per_page, 'graphene' ), 'window.grapheneInfScrollItemsPerPage', 'window.grapheneInfScrollItemsLeft' ), 'infScrollFinishedText' => __( 'No more items to fetch', 'graphene' ), 'commentsPerPage' => $comments_per_page, 'totalComments' => graphene_get_comment_count( 'comments', true, true ), 'infScrollCommentsMsg' => sprintf( __( 'Fetching %1$s more top level comment from %2$s left ...', 'graphene' ), 'window.grapheneInfScrollCommentsPerPage', 'window.grapheneInfScrollCommentsLeft' ), 'infScrollCommentsMsgPlural'=> sprintf( _n( 'Fetching %1$s more top level comment from %2$s left ...', 'Fetching %1$s more top level comments from %2$s left ...', $comments_per_page, 'graphene' ), 'window.grapheneInfScrollCommentsPerPage', 'window.grapheneInfScrollCommentsLeft' ), 'infScrollCommentsFinishedMsg' => __( 'No more comments to fetch', 'graphene' ), ); wp_localize_script( 'graphene-js', 'grapheneJS', apply_filters( 'graphene_js_object', $js_object ) ); } add_action( 'wp_enqueue_scripts', 'graphene_localize_scripts' );