-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathqvc-admin.php
46 lines (39 loc) · 1.54 KB
/
qvc-admin.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?php
if(!defined('ABSPATH'))exit;
add_filter('qtranslate_load_admin_page_config','qvc_add_admin_page_config');//obsolete
//add_filter('i18n_admin_config','qvc_add_admin_page_config');
function qvc_add_admin_page_config($page_configs)
{
{
$page_config = array();
$page_config['pages'] = array( 'post.php' => '', 'post-new.php' => '' );
/**
* List of scripts to be executed before "new qTranslateX" in 'qtranslate-x/admin/js/common.js'.
* It gives a chance to alter configuration variable qTranslateConfig.
* File paths are relative to 'plugins' directory.
*/
//$page_config['js-conf'] = array();
/**
* List of scripts to be executed after "new qTranslateX" in 'qtranslate-x/admin/js/common.js'.
* It gives a chance to execute additional actions on qTranslateConfig.qtx.
* File paths are relative to 'plugins' directory.
*/
$page_config['js-exec'] = array();
$js = &$page_config['js-exec']; // shorthand
$dir = qtranxf_dir_from_wp_content(__FILE__);
$js[] = array( 'handle' =>'qvc-js-exec', 'src' => $dir.'/qvc-admin-post.min.js', 'ver' => QVC_VERSION );
$page_configs[] = $page_config;
}
return $page_configs;
}
function qvc_admin_filters() {
global $pagenow;
if($pagenow != 'post.php') return;
add_filter('vc_frontend_editor_iframe_url', 'qvc_add_query_arg_language');
}
qvc_admin_filters();
function qvc_add_query_arg_language( $link ) {
$lang = qtranxf_getLanguageEdit();
//this will switch front-end active language via cookie 'qtrans_front_language', which is kind of ok.
return add_query_arg( array( 'lang' => $lang ), $link );
}