Forum Replies Created

Viewing 15 replies - 31 through 45 (of 80 total)
  • Hi Damien,

    Sounds like a theme compatibility issue, but am not 100% sure, as a first step I think it makes sense to be sure that you are using the latest WPML / WooCommerce / WooCommerce Multilingual versions, last week were launched two new beta versions that I recommend you install and that might solve your duplication issue – WPML Media beta & WooCommerce Multilingual beta, you can download both from ‘your account’ at the WPML web site – http://wpml.org.

    If after installing these new versions (please don’t forget to backup your data base & theme files before you do that) you still have this issue please post your issue at one of the WPML support forums – http://wpml.org/forums/forum/english-support/

    Hope that helps,
    Amit

    Hi,

    You can read the documentation for that here – http://wpml.org/documentation/related-projects/woocommerce-multilingual/#emails

    I suggest if you have got any further questions or issues with that please post a ticket on WPML support forum – http://wpml.org/forums/forum/english-support/

    Cheers!

    Hi Mohit,

    Can you please check you are using latest WPML 2.9.1 version ?
    Are you getting that with an already translated post ? What happens when you try to go directly to that post ? Is that error comes only form using the WPML language switcher ?

    The best would be to post that on WPML support forum – http://wpml.org/forums/forum/english-support/

    Thread Starter Amit Kvint

    (@webifish)

    Hey,

    Thanks!

    Amit

    Thread Starter Amit Kvint

    (@webifish)

    I think this might be closer though not working yet :

    <?php
    function do_shortcode($content) {
        global $shortcode_tags;
    
        if (empty($shortcode_tags) || !is_array($shortcode_tags))
            return $content;
    
        $pattern = get_shortcode_regex();
        return preg_replace_callback( "/$pattern/s", 'do_shortcode_tag', $content );
        $elements = parse($pattern);
    
        if (count($elements) > 0) {
            echo "Shortcode found: <b>".count($elements)."</b><br />";
    
            foreach ($elements as $element) {
                echo "<p>Tpl node: <pre>".$element($element->node)."</pre>";
            }
        }
    }
    ?>

    Can you take a look please ?

    Thread Starter Amit Kvint

    (@webifish)

    Hi Mike,

    Thanks.

    I did not find the way but I am on it, I think the best approach is to try end get the regex and then try to put it into a recursive PHP function, something along these lines –

    <?php
    function do_shortcode($content) {
        global $shortcode_tags;
    
        if (empty($shortcode_tags) || !is_array($shortcode_tags))
            return $content;
    
        $pattern = get_shortcode_regex();
        return preg_replace_callback( "/$pattern/s", 'do_shortcode_tag', $content );
    }
        $elements = parse($pattern);
    
        if (count($elements) > 0) {
            echo "Elements found: <b>".count($elements)."</b><br />";
    
            foreach ($elements as $element) {
                echo "<p>Tpl node: <pre>".htmlentities($element->node)."</pre>
                Tagname: <tt>".$element->tagname."</tt><br />
                Attributes: <tt>".$element->attributes."</tt><br />
                Omittag: <tt>".($element->omittag ? 'true' : 'false')."</tt><br />
                Inner HTML: <pre>".htmlentities($element->inner_html)."</pre></p>";
            }
        }
    ?>

    I’d most appreciate your remarks,
    Cheers,
    Amit

    Thread Starter Amit Kvint

    (@webifish)

    Hey did you mean something like that maybe ?

    $elements = parse($html);
    
    if (count($elements) > 0) {
        echo "Elements found: <b>".count($elements)."</b><br />";
    
        foreach ($elements as $element) {
            echo "<p>Tpl node: <pre>".htmlentities($element->node)."</pre>
            Tagname: <tt>".$element->tagname."</tt><br />
            Attributes: <tt>".$element->attributes."</tt><br />
            Omittag: <tt>".($element->omittag ? 'true' : 'false')."</tt><br />
            Inner HTML: <pre>".htmlentities($element->inner_html)."</pre></p>";
        }
    }
    ?>
    Thread Starter Amit Kvint

    (@webifish)

    Thanks! it actually does.

    I was just looking at the get_shortcode_regex() – http://wordpress.stackexchange.com/questions/4638/nested-shortcode-detection/4688#4688

    I guess I get get the regular expression and then do what you suggest with a counter increment ,do you have any example maybe of something similar for HTML tags ?

    Cheers!
    Amit

    Thread Starter Amit Kvint

    (@webifish)

    Have made some progress here –

    <?php
    
    add_action( ‘init’, ‘AddShortcodes’ );
    	function AddShortcodes() {
    	add_shortcode( ‘test’, ‘test’ );
    	add_shortcode( ‘test’, ‘test’ );
    }
    add_filter( ‘the_content’, ‘findDepth’, 0 );
    	function findDepth( $content ) {
    	/* Create an array of all the shortcode tags. */
    		$shortcode_tags = array(
    		‘test’,
    		‘test’,
    		);
    	}
    function array_depth($array) {
            $max_depth = 1;
    
            foreach ($array as $value) {
                if (is_array($value)) {
                    $depth = array_depth($value) + 1;
    
                    if ($depth > $max_depth) {
                        $max_depth = $depth;
                    }
                }
            }
            return $max_depth;
        }
    ?>

    Still won’t work though…
    Amit

    Thread Starter Amit Kvint

    (@webifish)

    I have gotten to hear then – now the question is – how do I connect these 2 functions…

    <?php
    function ArrayDepth($Array,$DepthCount=-1) {
      $DepthArray=array(0);
      $DepthCount++;
      $Depth = 0;
      if (is_array($Array))
        foreach ($Array as $Key => $Value) {
          $DepthArray[]=ArrayDepth($Value,$DepthCount);
        }
      else
        return $DepthCount;
      return max($DepthCount,max($DepthArray));
    }
    ?>
    
    <?php
    function do_shortcode($content) {
      global $shortcode_tags;
    
      if (empty($shortcode_tags) || !is_array($shortcode_tags))
        return $content;
    
      $pattern = get_shortcode_regex();
      return preg_replace_callback( "/$pattern/s", 'do_shortcode_tag', $content );
    }
    ?>
    Thread Starter Amit Kvint

    (@webifish)

    Any idea ?

    Thanks

    Thread Starter Amit Kvint

    (@webifish)

    Have came across this one for finding an array’s depth –

    Now is there a built WordPress functions that I can insert into that with an array of shortcodes ?

    <?php
    function ArrayDepth($Array,$DepthCount=-1) {
    // Find maximum depth of an array
    // Usage: int ArrayDepth( array $array )
    // returns integer with max depth
    // if Array is a string or an empty array it will return 0
      $DepthArray=array(0);
      $DepthCount++;
      $Depth = 0;
      if (is_array($Array))
        foreach ($Array as $Key => $Value) {
          $DepthArray[]=ArrayDepth($Value,$DepthCount);
        }
      else
        return $DepthCount;
      return max($DepthCount,max($DepthArray));
    }
    ?>

    [Please post code & markup between backticks or use the code button. Your posted code may now have been permanently damaged by the forum’s parser.]

    Thread Starter Amit Kvint

    (@webifish)

    OK I might have an idea here, mind you I’m not a PHP programmer so be gentle here…
    I think this would work to find the maximum depth of an array, now how can I insert my shortcodes into that array ? thanks….

    //finds the maximum depth in an array
    
    <?php
    
    function array_depth(array $array) {
        $max_depth = 1;
    
        foreach ($array as $value) {
            if (is_array($value)) {
                $depth = array_depth($value) + 1;
    
                if ($depth > $max_depth) {
                    $max_depth = $depth;
                }
            }
        }
    
        return $max_depth;
    }
    Thread Starter Amit Kvint

    (@webifish)

    Oh…

    That was for a client work, gone long ago, could not manage to solve it, but can’t remember what was done at the end…

    Cheers,
    Amit

    Forum: Fixing WordPress
    In reply to: Upgrade from 2.9.1
    Thread Starter Amit Kvint

    (@webifish)

    Yeah I know…that’s why the upgrade.

    Is there any way to look at the theme’s structure to evaluate the level of compatibility ?

    Thanks !

    Amit

Viewing 15 replies - 31 through 45 (of 80 total)