WordPress.org

Ready to get started?Download WordPress

Forums

Explanatory Dictionary
[resolved] does not work in excerpts (6 posts)

  1. sharonmiranda
    Member
    Posted 2 years ago #

    In blog excerpts, the full term definition shows right on the page rather than in a tooltop. FAQ question been up for some time unresolved.

    http://wordpress.org/extend/plugins/explanatory-dictionary/

  2. wallyO
    Member
    Posted 2 years ago #

    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.

  3. wallyO
    Member
    Posted 2 years ago #

    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.

  4. wallyO
    Member
    Posted 2 years ago #

    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.

  5. wallyO
    Member
    Posted 2 years ago #

    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');
    		}
    	}
    }
  6. Li-An
    Member
    Posted 1 year ago #

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

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic