Forum Replies Created

Viewing 5 replies - 1 through 5 (of 5 total)
  • i 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

    }

    /* 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

    }

    Plugin Author alibabaei

    (@alimotorolla)

    hi
    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 page

    if count of your categories is more than “250” then change it.

    Thread Starter alibabaei

    (@alimotorolla)

    hi back to me:D
    the problem solved

    since 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 tag

    then 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:D

    am i under ocean??? because no one answered me yet:D

    thanks in advance for any new suggestion.

Viewing 5 replies - 1 through 5 (of 5 total)