• Resolved Daniel

    (@ddumondgmailcom)


    Hello,

    The following command:

    <div class="menu-description">
    <?php if($menuname_category != '') :?>
    <?php $menuname_slugs = explode(',', $menuname_category);?>
    <?php $cat_menu = get_term_by('slug', $menuname_slugs[0], 'menu_type');?>
    <?php echo $cat_menu->description;?>
    <?php endif;?>
    </div>

    Is resulting in this:
    [:en]With Tomato Sauce[:fr]Avec sauce tomate[:]

    Is there anything I need to include so that it recognizes the tags?

    Thanks in advance for your help.
    Dan

    PS: I’m not very savvy when it comes to PHP so please be gentle! 🙂

    https://ww.wp.xz.cn/plugins/qtranslate-x/

Viewing 7 replies - 1 through 7 (of 7 total)
  • Thread Starter Daniel

    (@ddumondgmailcom)

    I’m not sure if it makes a difference, but this code is used inside a custom widget. It’s meant to display the “category descriptions” from a “custom post”.

    Thread Starter Daniel

    (@ddumondgmailcom)

    Hahah! I did some digging on your forum and found the solution!

    I just had to change:
    <?php echo $cat_menu->description;?>

    to:
    <?php echo __($cat_menu->description);?>

    Sweet!! 🙂

    Plugin Author John Clause

    (@johnclause)

    Yes, this would work, although a bit less efficient than this solution:
    https://qtranslatexteam.wordpress.com/faq/#DevelperNotes

    Moreover, if you take the latest version, it might have $cat_menu->description already translated at front end in your code.

    It would be great if you test that latest version for term handling: add term in a various ways, remove, edit, etc. It has some fixes and improved term handling. Every tester’s input is very valuable for us.

    If you find a problem, it is better to report via contact form for quicker processing.

    Thanks a lot!

    Thread Starter Daniel

    (@ddumondgmailcom)

    Thanks for the helpful feedback John! 🙂

    I didn’t realize newer versions of the plugin was available for download and use outside the wordpress platform.

    Just curious as to why this is? I’m so used to updating via the plug-ins section of my websites.

    Is there an approval process (like what apple does with their apps) before stable versions of plug-ins are available within WordPress?

    Cheers!

    Plugin Author John Clause

    (@johnclause)

    Even within WP interface, you may upload a new plugin if you have a .zip file. There is nothing special about it, anyone can install any plugin by uploading a .zip file, or even simply putting a folder with plugin’s files on file system via FTP, for example. When WP does update, they simply take such a .zip file from a designated place.

    Yes, we test things a lot before making a new version available via WP designated place. Read about plugin development in WP docs, for example: https://ww.wp.xz.cn/plugins/about/faq/ People take plugin for testing from other places, depending on how an author of a plugin designed it.

    Many, if not most, of plugins have a repository at GitHub, like us, https://github.com/qTranslate-Team/qtranslate-x, where people can see the code test it, discuss it and suggest modifications via pull requests.

    You are welcome to join the community!

    Thread Starter Daniel

    (@ddumondgmailcom)

    Hey John! Thanks for the invite — I would certainly need to create a test site in order to take advantage of this.

    I actually knew you could manually install a “zipped” file through the “add plugin” feature within WordPress — What I didn’t know is that there are “stable versions” of the plugin out there that aren’t recognized from within the WordPress platform.

    Just curious as to why (if they’re marked as stable) they are not released through the WordPress platform?

    I know we’re off topic here, but I appreciate the insight.

    Cheers! 🙂

    Plugin Author John Clause

    (@johnclause)

    “Stable” is just a name of the branch we currently use for the latest version. It is still being tested though. There is a problem with some advanced caching plugin, for example, which most people would not care, but we still want to make it clean … and so on … and so forth.

    Best!

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

The topic ‘PHP Command Outputting Shortcode to Front End’ is closed to new replies.