• Resolved PauloCot

    (@paulocot)


    Just wondering how you can change both the show and hide replies link to be included in an existing div.

    I ask because it’s actually a span class and I’m not sure how, or if I should, change that

    Is this the code that needs changing:

    class bb_Walker_Comment extends Walker_Comment {
    
    	function start_lvl(&$output, $depth = 0, $args = array()) {
        	$GLOBALS['comment_depth'] = $depth + 1;
        	$options = get_option('bb_jcr_options');
    
    		switch ( $args['style'] ) {
    			case 'ol':
    				echo "<span class='replylink'><span class='show'>" . $options['show_replies'] . "</span>\n</span>\n";
    				echo "<ol class='children'>\n";
    				break;
    			default:
    			case 'ul':
    				echo "<span class='replylink'><span class='show'>" . $options['show_replies'] . "</span>\n</span>\n";
    				echo "<ul class='children'>\n";
    				break;
    			}
    	}
    
    	function end_lvl(&$output, $depth, $args) {
    
    		$GLOBALS['comment_depth'] = $depth + 1;
    
    		switch ( $args['style'] ) {
    			case 'ol':
    				echo "<!--/children-->\n";
    				echo "</ol>\n";
    				break;
    			default:
    			case 'ul':
    				echo "<!--/children-->\n";
    				echo "</ul>\n";
    				break;
    		}
    	}
    }

    It’s important the show and hide button are in the same format.

    Thanks in advance!

    https://www.ads-software.com/plugins/jquery-expandable-comments/

Viewing 1 replies (of 1 total)
  • Plugin Author Doodlebee

    (@doodlebee)

    I don’t understand what you mean about it “being in the same format”?

    the “div” option doesn’t work with my plugin. I’ve tried many times to get it going with “divs”, but it typically ends up breaking the site for reasons I haven’t been able to figure out. (I’m actually working in a new version *now* – to be released with WordPress 3.7 – that will hopefully have the “div” option enabled, but it’s been a long-time issue for me to get that sorted.) That’s why your only choices are “ol” and”ul”.

    You *can* change it, but note that, when you do, in your comment layout callback, you need to add in an extra “</div>” tag at the end to close out what it opens. But to add it in, ust pop in:

    case: 'div':
    	echo "<span class='replylink'><span class='show'>" . $options['show_replies'] . "</span>\n</span>\n";
    	echo "<div class='children'>\n";
    	break;

    in the top, and a corresponding </div> in the bottom section. But again, you’ll have to add in an extra closing div tag at the end of your comment callback, or the site layout will break.

    Also note that if I don’t get the “div” format working by 3.7, if you update the plugin, these changes will be wiped – so be sure to save it as another filename so you can refer back to it if I update it without this fix. (which is possible, because I’ve been trying to get the div option to work for several versions, to no avail. it’s a headbanger, for sure. I’d love it to work, too – because I prefer the nested divs over lists, myself.)

Viewing 1 replies (of 1 total)
  • The topic ‘Changing the div’ is closed to new replies.