Viewing 5 replies - 1 through 5 (of 5 total)
  • Hi Sharon,
    I have been playing with Explanatory dictionary for a few days now, with similar problems to yourself, though in my case the problem occurred when I used html p tags, or h3 tags in the explanation text.
    The explanation text accepts html, and in my case I actually have a lightbox image gallery in an explanation.
    The problem occurs when the html is improperly nested, for example a p tag inside another p tag. WordPress then quite correctly fixes the improper nesting by adding a closing p tag and a new opening p tag.
    SOLUTION: I chose to use span tags with a class instead of p tags and h tags inside the explanation text. For example,

    <span class="MyHeading">Heading</span>
    <span class="MyParagraph">Paragraph text</span>

    Then styled these classes in my templates styles.css file to look like headings and paragraphs.

    span.MyHeading{ display:block; color:#750909; font-weight:bold; font-size:14px;}
    span.MyParagraph{ display:block; margin:0 0 10px 0;}

    Hope this helps someone.

    I just tested with a defined word in an excerpt and as the original poster stated, the definition text is output as part of the excerpt.
    I too would like to see this problem fixed.

    It would be good if the plugin left excerpts alone. (feature request?)
    SOLUTION
    To force this behavior I found the following code placed in the themes functions.php prevented the excerpts in search and archive pages from being altered.

    add_filter('loop_start', 'remove_explanatory_dictionary_words');
    function remove_explanatory_dictionary_words() {
    	if (is_search() | is_archive() ) {
    		remove_filter('the_excerpt', 'add_explanatory_dictionary_words');
    		remove_filter('the_content', 'add_explanatory_dictionary_words');
    	}
    }

    When the plugin is deactivated, this filter seems to fail silently (which is good). Perhaps though it may be more proper to conditionally check if the plugin is activated before adding this filter.

    Like this.

    if (function_exists('add_explanatory_dictionary_words')) {
    	add_filter('loop_start', 'remove_explanatory_dictionary_words');
    	function remove_explanatory_dictionary_words() {
    		if (is_search() | is_archive() ) {
    			remove_filter('the_excerpt', 'add_explanatory_dictionary_words');
    			remove_filter('the_content', 'add_explanatory_dictionary_words');
    		}
    	}
    }

    Thanks for the tip ! I had the same problem and even worst because it shows in RSS feed !

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘[Plugin: Explanatory Dictionary] does not work in excerpts’ is closed to new replies.