Forum Replies Created

Viewing 6 replies - 16 through 21 (of 21 total)
  • anou

    (@anou)

    Big thanks @keesiemeijer !!!

    Hello Chouby,
    First I must say thank you for your plug-in. Best solution for multilingual websites I’ve tested for now.

    I post here a Warning because I didn’t find anywhere a post related to my bug.
    I have installed polylang 1.2.4. When I go to wp-admin/options-general.php?page=mlang&tab=strings, I get this warning:
    Warning: Invalid argument supplied for foreach() in .../wp-content/plugins/polylang/admin/settings.php on line 298

    Did not seem to be a problem for edition and record the translated string but was a bit akward.

    After some tests, I found that $widgets var was returning FALSE, so I modified a bit line 295 like this:

    if ($sidebar == 'wp_inactive_widgets' || !isset($widgets) || !$widgets)
    	  continue;

    Has you can see, I added || !$widgets

    And now I feel better without this warning and I can thank you again for you work.

    Keep it up!

    And for me I add to display also posts associated to each category, so here’s my final function, if it can help anyone.

    //get parent/child taxonomy in right order and display associated posts
    function taxonomy_terms_hierarhically_output($parent_id, $taxonomy) {
      $args = array('parent'    =>  $parent_id, 'orderby' => 'term_order', 'hide_empty' => false);
      $child_terms = get_terms($taxonomy, $args);
    	$taxIDone = function_exists('pll_get_term') ? pll_get_term(1) : 1;
    
      //if no child terms found return
      if(count($child_terms) < 1)
          return;
    
      foreach ($child_terms as $child_term) {
        $htag = $child_term->parent != 0 ? '3' : '2';
        echo '<h' . $htag . '>' . $child_term->name;
          //process the child terms if exists
          taxonomy_terms_hierarhically_output($child_term->term_id, $taxonomy);
        echo '</h' . $htag . '>';
    
        //display category posts
        echo $child_term->term_id != $taxIDone ? '<ul>':'';
    
    		$args = array(
    			'post_type' 		=> 'post',
    			'category'	     => $child_term->term_id,
    			'posts_per_page'   => -1
    		);
    		$posts = get_posts($args);
    
    		if ( $posts && $child_term->term_id != $taxIDone ) {
    			foreach($posts as $post) {
    				setup_postdata($post);
    
    				?><li><?php echo $post->post_title;?>
            <span class="edit-link"><a href="
                <?php echo get_edit_post_link($post->ID);?>"><?php _e( 'Edit', 'YOUR_THEME_NAME' );?></a></span></li>
    
    			<?php
    			} //end foreach($posts
    		}
        echo $child_term->term_id != $taxIDone  ? '</ul>':'';
    
      }//end foreach($child_terms...
    }

    Some code are specific to my theme but still maybe useful to someone. If not I’ll be glad to explain how to get rid of it ??

    And Thanks again for your plugin!

    Hello,
    You must add some arguments in the function to get the categories in the right order:

    $args = array('parent' => $parent_id, 'orderby' => 'term_order', 'hide_empty' => false);

    Still got the Notice. And it’s on line 168… What should be the $css var ?
    and thanks for your plugin.

    Hello alineo,
    could you be more precise to where to put your lines of code in the original code please ? Maybe if you can give me some of the original code that’s before and after your changes ?

    Thanks a lot
    Merci
    David

Viewing 6 replies - 16 through 21 (of 21 total)