WordPress.org

Ready to get started?Download WordPress

Forums

Easy Random Quotes
Allow for multilingual quotes (1 post)

  1. pander
    Member
    Posted 3 years ago #

    Hi trepmal,

    I have made a quick hack to allow for multilingual qoutes. The quotes need to be entered according to the following format (for this hack):

    en@The apple is green.#nl@De appel is groen.

    The code needs to be altered to:

    function erq_shortcode( $atts = array( 'id' => 'rand' ) ) {
    ...
            $use = ( 'rand' == $id ) ? array_rand( $theQuotes ) : $id;
            $all = explode("#", stripslashes( $theQuotes[ $use ] ));
            $quote = "";
            foreach($all as $each) {
                    $kv = explode("@", $each);
                    if ($kv[0] == ICL_LANGUAGE_CODE) {
                            $quote = $kv[1];
                    }
            }
            return $quote;
    }

    and it works. Please consider this feature request and provide a proper implementation. Perhaps a setting (default off) needs to be provded too to activatie this behaviour.

    Best regards,

    Pander

    PS I am using WPML too.

    http://wordpress.org/extend/plugins/easy-random-quotes/

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic