Forum Replies Created

Viewing 9 replies - 1 through 9 (of 9 total)
  • I think sushicodeur’s is the way to go.
    Here are two custom walkers, one to extract the current sub-menu, the other to omit it

    [Code moderated as per the Forum Rules. Please use the pastebin]

    This works:
    add_filter( 'disable_captions', create_function('$a', 'return true;') );

    I had the same problem and I found the solution in the codex:
    https://codex.www.ads-software.com/Template_Tags/the_content#Alternative_Usage

    You probably missed a { or a }.
    No pro’ bro’, maybe its easier for you to replace the whole function, which starts at line 41. Here’s the code:

    function _cat_rows( $categories, &$count, $parent = 0, $level = 0, $page = 1, $per_page = 20 ) {
    	if ( empty($categories) ) {
    		$args = array('hide_empty' => 0);
    		if ( !empty($_GET['s']) )
    			$args['search'] = $_GET['s'];
    		$categories = get_categories( $args );
    	}
    	if ( !$categories )
    		return false;
    
    	$children = _get_term_hierarchy('category');
    
    	$start = ($page - 1) * $per_page;
    	$end = $start + $per_page;
    	$i = -1;
    	ob_start();
    	foreach ( $categories as $category ) {
    		if ( $count >= $end )
    			break;
    
    		$i++;
    
    		if (!empty($_GET['s']))
    		{
    			echo "\t" . _cat_row( $category, $level);
    		}
    
    		else
    		{
    			if ($category->parent != $parent )
    				continue;
    
    			// If the page starts in a subtree, print the parents.
    			if ( $count == $start && $category->parent > 0 ) {
    				$my_parents = array();
    				while ( $my_parent) {
    					$my_parent = get_category($my_parent);
    					$my_parents[] = $my_parent;
    					if ( !$my_parent->parent )
    						break;
    					$my_parent = $my_parent->parent;
    				}
    				$num_parents = count($my_parents);
    				while( $my_parent = array_pop($my_parents) ) {
    					echo "\t" . _cat_row( $my_parent, $level - $num_parents );
    					$num_parents--;
    				}
    			}
    
    			if ( $count >= $start )
    				echo "\t" . _cat_row( $category, $level );
    
    			//unset($categories[$i]); // Prune the working set
    			$count++;
    
    			if ( isset($children[$category->term_id]) )
    				_cat_rows( $categories, $count, $category->term_id, $level + 1, $page, $per_page );
    		}
    	}
    
    	$output = ob_get_contents();
    	ob_end_clean();
    
    	echo $output;
    }

    Install the TinyMCE Advanced plugin
    https://www.ads-software.com/extend/plugins/tinymce-advanced/

    Go to Settings > TinyMCE Advanced
    Toward the bottom of the page check the apprpriate option: “Stop removing the <p> and <br /> tags when saving and show them in the HTML editor”
    Click “Save changes”

    To actually fix the search, you’ll have to substitute the block of code from lines 64 to 92 with the following. Of course, next time you upgrade WordPress, if the issue hasn’t been fixed, you’ll have to to this again.


    if (!empty($_GET['s']))
    {
    echo "\t" . _cat_row( $category, $level);
    }

    else
    {
    if ($category->parent != $parent )
    continue;

    // If the page starts in a subtree, print the parents.
    if ( $count == $start && $category->parent > 0 ) {
    $my_parents = array();
    while ( $my_parent) {
    $my_parent = get_category($my_parent);
    $my_parents[] = $my_parent;
    if ( !$my_parent->parent )
    break;
    $my_parent = $my_parent->parent;
    }
    $num_parents = count($my_parents);
    while( $my_parent = array_pop($my_parents) ) {
    echo "\t" . _cat_row( $my_parent, $level - $num_parents );
    $num_parents--;
    }
    }

    if ( $count >= $start )
    echo "\t" . _cat_row( $category, $level );

    //unset($categories[$i]); // Prune the working set
    $count++;

    if ( isset($children[$category->term_id]) )
    _cat_rows( $categories, $count, $category->term_id, $level + 1, $page, $per_page );

    I also had an issue with categories just not showing in the admin panel (regardless of search), so I did a bit of debugging.
    The bug is in the _cat_rows function, which starts at line line 40 of \wp-admin\includes\template.php

    To cure the not showing up of categories, just comment line 87, like so

    //unset($categories[$i]); // Prune the working set

    Hi Guys, allow me to join the club.
    I’ll look for a plugin to provide a workaround in WP 2.7.1. Any ideas?

    The only way I’ve found is to: click Add Media, Media Gallery, select the image, Show, File URL, and finally copy the URL that appears. Does anyone knows of a quicker way?

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