alibabaei
Forum Replies Created
-
Forum: Plugins
In reply to: [WordPress Language] AJAX request of plugin loads wrong textdomain on fronti think correct way should be this, because of textdomain for translations:
/* if qTranslate is installed */
/* set front locale for ajax calls requested from front-end */function set_locale_for_frontend_ajax_calls() {
if ( is_admin() && defined( ‘DOING_AJAX’ ) && DOING_AJAX
&& substr( $_SERVER[‘HTTP_REFERER’], 0, strlen( admin_url() ) ) != admin_url() ) {load_theme_textdomain( ‘your-theme-domain-name’, get_template_directory() . ‘/languages’ );
}
}add_action( ‘admin_init’, ‘set_locale_for_frontend_ajax_calls’ );
add_action(‘wp_head’,’jsURLs’);
function jsURLs(){
global $q_config;
?><script type=”text/javascript”>
/* <![CDATA[ */
var ajaxurl = “<?php echo admin_url(‘admin-ajax.php?lang=’.$q_config[‘language’]); ?>”;
/* ]]> */
</script><?php}
it works for me if qTranslate is installed
but if not following maybe work:
/* if qTranslate is not installed */
/* set front locale for ajax calls requested from front-end */function set_locale_for_frontend_ajax_calls() {
if ( is_admin() && defined( ‘DOING_AJAX’ ) && DOING_AJAX
&& substr( $_SERVER[‘HTTP_REFERER’], 0, strlen( admin_url() ) ) != admin_url() ) {
setlocale(LC_ALL, $_GET[‘lang]);
load_theme_textdomain( ‘your-theme-domain-name’, get_template_directory() . ‘/languages’ );
}
}add_action( ‘admin_init’, ‘set_locale_for_frontend_ajax_calls’ );
add_action(‘wp_head’,’jsURLs’);
function jsURLs(){
global $q_config;
?><script type=”text/javascript”>
/* <![CDATA[ */
var ajaxurl = “<?php echo admin_url(‘admin-ajax.php?lang=’.get_locale()); ?>”;
/* ]]> */
</script><?php}
Forum: Plugins
In reply to: WordPress doesn't load correct mo-file via AJAX request/* if qTranslate is installed */
/* set front locale for ajax calls requested from front-end */function set_locale_for_frontend_ajax_calls() {
if ( is_admin() && defined( ‘DOING_AJAX’ ) && DOING_AJAX
&& substr( $_SERVER[‘HTTP_REFERER’], 0, strlen( admin_url() ) ) != admin_url() ) {load_theme_textdomain( ‘your-theme-domain-name’, get_template_directory() . ‘/languages’ );
}
}add_action( ‘admin_init’, ‘set_locale_for_frontend_ajax_calls’ );
add_action(‘wp_head’,’jsURLs’);
function jsURLs(){
global $q_config;
?><script type=”text/javascript”>
/* <![CDATA[ */
var ajaxurl = “<?php echo admin_url(‘admin-ajax.php?lang=’.$q_config[‘language’]); ?>”;
/* ]]> */
</script><?php}
it works for me if qTranslate is installed
but if not following maybe work:
/* if qTranslate is not installed */
/* set front locale for ajax calls requested from front-end */function set_locale_for_frontend_ajax_calls() {
if ( is_admin() && defined( ‘DOING_AJAX’ ) && DOING_AJAX
&& substr( $_SERVER[‘HTTP_REFERER’], 0, strlen( admin_url() ) ) != admin_url() ) {
setlocale(LC_ALL, $_GET[‘lang]);
load_theme_textdomain( ‘your-theme-domain-name’, get_template_directory() . ‘/languages’ );
}
}add_action( ‘admin_init’, ‘set_locale_for_frontend_ajax_calls’ );
add_action(‘wp_head’,’jsURLs’);
function jsURLs(){
global $q_config;
?><script type=”text/javascript”>
/* <![CDATA[ */
var ajaxurl = “<?php echo admin_url(‘admin-ajax.php?lang=’.get_locale()); ?>”;
/* ]]> */
</script><?php}
Forum: Reviews
In reply to: [WP Template On The Fly] Useless Pluginhi
i was working on my site until now.
its ready now but i need more time for documentations.
in fact there is no document in my site yet!
give me 1 or 2 day till i complete documents.
if you have any number of question about plugin, i will respond them if you leave comment on WP Template On The Fly 1.0 post, which its link is:https://alibabaei.com/wp-template-on-the-fly-1-0/
thanks
hi
/wp-admin/includes/nav-menu.php
line: 804
change this line:
// paginate browsing for large numbers of objects
$per_page = 50;
to this:
// paginate browsing for large numbers of objects
$per_page = 250;
then you increased the number of categories per page, so categories should be loaded in one pageif count of your categories is more than “250” then change it.
Forum: Plugins
In reply to: [Rating-Widget: Star Review System] hihi back to me:D
the problem solvedsince i:
1- moved the_content() function to single-ajax.php
*** wp_footer hook of wp was unable to load Rating-Widget JS loader because it was seeking ‘the_content’ hook to load Rating-Widget JS loader.then i decide to:
2- put do_action(‘the_content’) before get_footer()
*** but the problem not solved because JS loader was executed before incoming html tagthen i decide to:
3- put get_footer() in single-ajax.php
*** the problem solved
but i have a new problem, which is, loading huge content of footer and several <script> tags in it, through ajax, which is heavy on heavy:Dam i under ocean??? because no one answered me yet:D
thanks in advance for any new suggestion.