Forum Replies Created

Viewing 8 replies - 1 through 8 (of 8 total)
  • Thread Starter David Szego

    (@dszego)

    I like your solution better! Thanks!!

    In includes/wp-greet-box.class.php, around line 149, wrap a do_shortcode around the text being returned. This will allow a shortcode to be processed.

    You can alter the code at the same place to basically do what you want (process PHP, texturize, etc.)

    function get_message_html($message, $close) {
          $html = '';
          if ( strlen ( $message['icon'] ) > 0 ) {
            // do not show icon if there is no icon url
            $html .= $this->o['before_icon'].$this->get_icon_html($message['icon'], $message['icon_link']).$this->o['after_icon'];
          }
          if($close && $this->o['can_close']) {
            $html .= '<div class="greet_block_close"><a id="greet_block_close" href="#">X</a></div>';
          }
          //DS: Wrapped text in do_shortcode to include posts as greet blocks
          $html .= do_shortcode($message['text']);
    
          return $html;
        }

    I’m using it in http://www.talmud-wiki.org to put posts in a greet box via the WordPress-custom-post-widget plugin…. Basically, my greet box consists of:

    [content_block="702"]

    and post #702 (a custom type from that plugin) shows up in the Greet Box.

    Thaya – Please include this in the next version, perhaps with a checkbox for each greetbox saying “Process content of GreetBox” to turn the feature on/off per box.

    Thanks,
    David Szego

    Thread Starter David Szego

    (@dszego)

    I think you have it right but I’ll be clearer:

    On the menubar or wherever, there should be a flag for each language, allowing you to switch the entire site to the language you click on. Redirect this to the home page if selected.
    …I’m not as concerned about that, although I’d like to know which call to use to put it in my theme.

    For each article:
    I’d like a call which displays the flags of *that article’s* translations.
    So, if I put in my theme something like:

    <?php echo the_title() . ' | ' . the_translations(array('flags'=>'true','names'=>'false')); ?>

    I will get:

    An Article With English And French Translations | [BritFlag] [FranceFlag]

    or putting:

    <?php echo the_title() . ' | ' . the_translations(array('flags'=>'true','names'=>'true')); ?>

    could give me:

    An Article Only In Italian | [ItalFlag] Italian

    That would let me “flip” between translations on each article.

    Whether a flag is displayed for the current language, should be an admin option.

    Thread Starter David Szego

    (@dszego)

    That’s excellent… Could I suggest you think of it a little differently though:

    If you do a straight copy on creation of a new translation, the linked articles may eventually get out of sync.

    Say I create a new translation from post 855 (English) which becomes post 900 (French).

    GOOD:
    The tags get copied from 855, and any tags which have French translations get put into the metadata of post 900.

    (Note – when I say “tags”, really it can apply to Categories, Taxonomies, and anything else with a translation)

    PROBLEM:
    The next day, I add/change/delete the tags from the English article.
    French will still have the “old” tags.

    PROBLEM:
    I later translate a tag of 855 into French.
    900’s metadata, which *would* have had the French tag added if I had translated earlier, will not get updated with the now-translated tag.

    SOLUTION:
    If you create a new table containing the links between articles like this:

    Lang1ID  |  Lang2ID  |  Lang3 ID  |  etc.
      855    |     900   |

    you could also add a filter for the_content (or perhaps the_tags) which:
    – reads the tags on all linked articles (in this case, 855 and 900)
    – checks if any tags exist in Lang1 that have a translation to Lang2
    – permanently or temporarily adds the translated tag to the article’s translation (selectable as an admin option)

    Now, when I read the French article 900, *after* I’ve added some new tag translations, and removed some tags from article 855, I will *still* see matching tags in both.

    This would also let you add a button where you could “sync” article tags (and categories, taxonomies, etc.) by looping through every post like this:

    - foreach post_ID in the default language
         - make an array translations of all it's translations
         - make an array defaultLangTags of it's tag/tax/cat ID's in the default language
       - foreach translationLang in translations
         - foreach tag in defaultLangTags
           - see if a translation exists in translationLang for that tag
           - apply it to translationLang's post_ID
         - (repeat for cat's, tax's, etc.)

    BIG PICTURE:
    This goes hand-in-hand with my other post about “flipping languages”:
    You will be able to click on French / English flags, and read the article in either language, and also see the same tags in both articles (assuming translations exist. Maybe as an option, you could show tags from the default language if the default language’s article has a tag for which no translation exists.)

    Currently, it sort of looks like there’s an English article (post), and a French article – but they’re separate articles.

    Combined together, (this post and the flag post), Polylang could make it look like an article is “An Article” (unified), and all you have to do to read it in a different language, is click on the flag!

    Anyways, my site is totally in development – not “production” at all, so I’m happy to put 0.6 on and play around and help you code it.

    Email me at info@talmud-wiki.org if you’d like to discuss further.

    Cheers,
    David.

    Thread Starter David Szego

    (@dszego)

    Thank you, that explains why the 2nd flag showed up after the first post in the 2nd language.

    What would be the best call for showing languages of *this post*, to allow flipping between languages on a per-post basis?

    Thread Starter David Szego

    (@dszego)

    Fixed it by changing all instances of get_bloginfo(‘url’) to site_url() in includes/class-wp-external-links.php

    Cheers!

    Thread Starter David Szego

    (@dszego)

    Put it in, I’ll test and help develop it! The sooner the better! Great to hear.

    To get around “disturbances”, it could simply be an option (copy or not) in Polylang’s settings.

    Bump. I’m trying to debug this too…
    Say we’ve defined the word “TERM”, and we have this in our post:

    This term has a busy schedule here's a <a href="wherever" title="Term schedule">link</a>

    This will get completely screwed up and try to put a tooltip over the word “Term” in the “title=” tag.

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