WordPress.org

Ready to get started?Download WordPress

Forums

Relevanssi - A Better Search
[resolved] "Read More..." link is doubled (31 posts)

  1. eleanorb
    Member
    Posted 2 years ago #

    Each link appears twice in succession, looks like this for each item returned:

    ...All are welcome — please join us! – Susan Mansfield-Jones . . . → Read More: Friendship Link: Movie and lunch, Wed., Jan. 25… . . . → Read More: Friendship Link: Movie and lunch, Wed., Jan. 25

    (Problem is now on my development site on my local computer, not visible to outside world..)

    http://wordpress.org/extend/plugins/relevanssi/

  2. Mikko Saari
    Member
    Plugin Author

    Posted 2 years ago #

    What kind of settings you have in place?

  3. eleanorb
    Member
    Posted 2 years ago #

    You can see my current settings at http://dl.dropbox.com/u/5293565/RelevanssiSettings.png

    Thanks for your interest!

  4. Mikko Saari
    Member
    Plugin Author

    Posted 2 years ago #

    What's in your search results template?

  5. eleanorb
    Member
    Posted 2 years ago #

    How do I find that out?

  6. Mikko Saari
    Member
    Plugin Author

    Posted 2 years ago #

    It's in your template files, usually search.php.

  7. eleanorb
    Member
    Posted 2 years ago #

    Okay, let's see. First, I have made no changes in any of the program files in the folder relevanssi. In the file search.php in the relevanssi folder, I have searched for the word "template" and found nothing. Is this what you mean? If not, perhaps I am too unskilled to understand your message.

  8. tsalzer
    Member
    Posted 1 year ago #

    I'm getting the same thing: duplicate "more" links on search results. Disabling Relevanssi eliminates this behavior. Somehow, Relevanssi and my theme functions are not playing well together. Live example: http://conservationdistrict.org/?s=budget

  9. eleanorb
    Member
    Posted 1 year ago #

    I'm not sure why you think the theme is responsible however. I see you are using Clear Line Theme, and I am using Atahualpa. Also, I'm not sure when this started. It is occurring on both my online and development versions, one using WP 3.0.5 and the other 3.4.1.

  10. Mikko Saari
    Member
    Plugin Author

    Posted 1 year ago #

    Eleanorb, please copy the whole search.php file (that IS the search results template) to a pastebin and show it to me.

    It is very much a theme issue, and probably caused by the way your theme is adding those more links. Tsalzer, you too could post your search results template to a pastebin so I can take a look at it.

  11. Mikko Saari
    Member
    Plugin Author

    Posted 1 year ago #

    Actually, based on another thread here, I think I may have a clue. Your site may be adding the more link with the get_the_excerpt filter call, which gets called twice, for some reason.

  12. eleanorb
    Member
    Posted 1 year ago #

    Mikko, thanks for your help. I've placed the search.php file in my dropbox, http://dl.dropbox.com/u/5293565/search.php
    Let me know what I can do to debug the get_the_excerpt possibility. I see this call in a number of files, in relevanssi, in the wp_includes folder, and in functions.php of my theme.

  13. Mikko Saari
    Member
    Plugin Author

    Posted 1 year ago #

    That's not your search results template, that's the search.php file from Relevanssi.

    Your search results template is located in your theme folder in wp-content/themes/. Also it might be useful to take a look at the functions.php of your theme as well.

  14. eleanorb
    Member
    Posted 1 year ago #

    My theme is Atahualpa, which does not have a file search.php. (See list of theme files at http://dl.dropbox.com/u/5293565/EleanorTheme.png)
    I do have a file functions.php, but I don't know what to look for. I have placed that file at http://dl.dropbox.com/u/5293565/functions.php so you can check it out. Thanks!

  15. Mikko Saari
    Member
    Plugin Author

    Posted 1 year ago #

    Ok, it's probably the bfa_wp_trim_excerpt() function, which is behind this. Maybe. You can try finding this line in the functions.php:

    add_filter('get_the_excerpt', 'bfa_wp_trim_excerpt');

    and change it to

    //add_filter('get_the_excerpt', 'bfa_wp_trim_excerpt');

    See if that helps.

  16. eleanorb
    Member
    Posted 1 year ago #

    Sorry, that doesn't seem to change anything... Still getting the double 'more's.

  17. tsalzer
    Member
    Posted 1 year ago #

    And mine must be in the theme functions.php file. Temporarily activated the Twenty Eleven theme and there is no problem with doubled links in the search results. Reverting back to my Clear Line theme I get two "more" links. I'm just not seeing where this is doubled in the theme functions file!

  18. Mikko Saari
    Member
    Plugin Author

    Posted 1 year ago #

    In that case I'm sorry, but I don't know what is causing the problem. It is some kind of problem in how your theme and Relevanssi work together, and I simply can't support all theme combinations.

  19. tsalzer
    Member
    Posted 1 year ago #

    Mikko, I certainly don't expect you to try to support the many, many themes available for WordPress! Thanks for your great work on Relevanssi :-)

  20. JochenT
    Member
    Posted 1 year ago #

    Today I've encountered the same problem, but with theme TwentyEleven. Only for a post with a manually created excerpt the more link was doubled. This only occured on a dev server with the newest plugin version 3.0.5. The same content on the live server and with version 3.0.4 had not the problem. Disabling the new version 3.0.5 also removes the doubled more link.

    I use a customized more link which is hooked at the get_the_excerpt filter. Also I remove the default TwentyEleven function twentyeleven_custom_excerpt_more() from this hook. The latter one is done via action hook after_setup_theme.

    // Remove "read more" function set by theme TwentyEleven for manually created excerpts
    function mygeneric_setup() {
        remove_filter( 'get_the_excerpt', 'twentyeleven_custom_excerpt_more');
    }
    add_action( 'after_setup_theme', 'mygeneric_setup', 40);
    
    // Add a modified "read more" link for manually created excerpts
    function my_custom_excerpt_more($more) {
    	return ' <a href="' . get_permalink() . '">Continue …</a>';
    }
    add_filter( 'get_the_excerpt', 'my_custom_excerpt_more');
  21. Mikko Saari
    Member
    Plugin Author

    Posted 1 year ago #

    This is a problem with both Twenty Ten and Twenty Eleven themes, but the current version of Relevanssi (3.1) fixes it.

  22. eleanorb
    Member
    Posted 1 year ago #

    Sigh, the Relevanssi 3.1 (actually 3.1.1) version doesn't change the double-more problem with Atahualpa theme...

  23. JochenT
    Member
    Posted 1 year ago #

    Hi Mikko,
    your "Hack to fix a problem with Twenty Eleven custom excerpts" in file excerpts-highlights.php fails under several conditions.

    First, if filter 'twentyeleven_custom_excerpt_more' has been removed previously (e.g. in functions.php) it will be always activated by your code after the first post found. You may use function has_filter( 'get_the_excerpt', 'twentyeleven_custom_excerpt_more') to remove and reinstall that filter.

    Second, if someone like me has removed filter 'twentyeleven_custom_excerpt_more' in functions.php and set an alternative 'more' filter this hack fails completely. For custom excerpts I get currently up to three more links.

    Also the call to apply_filters('get_the_excerpt', $excerpt) should positioned after appending the closing ellipsis. Otherwise the ellipsis is appended after the more link.

    The problem only occurs with custom excerpts and not with auto created excerpts. But any filter which adds a more link to a custom excerpt has to check for existence of that custom excerpt with function has_excerpt().
    A solution may be to temporarily delete the value of $post->post_excerpt. Thus the call to apply_filters('get_the_excerpt', $excerpt) in your plugin will not create an additional more link.

    I've just testet this and it seems to work properly. Modify in function relevanssi_do_excerpt():

    $excerpt_save = $post->post_excerpt;
    $post->post_excerpt = '';
    $excerpt = apply_filters('get_the_excerpt', $excerpt);
    $post->post_excerpt = $excerpt_save;

    (Delete all the code which adds and removes filters 'twentyten_custom_excerpt_more' and 'twentyeleven_custom_excerpt_more'.)

    I hope this helps a bit and thank you for that phantastic plugin.
    Jochen

  24. Mikko Saari
    Member
    Plugin Author

    Posted 1 year ago #

    That seems like a nice solution. I do admit the current solution is a bit of a quick hack, with little thought given to more complex implications.

  25. infrcl
    Member
    Posted 1 year ago #

    Hi!

    A temporary workaround for atahualpa is to hide the second "Read More..." link.

    You have to add in the 'Add HTML/CSS Inserts' the following code:

    .search-results div.post-bodycopy p span:last-child {
    display: none;
    }

    This doesn't work for IE8 and earlier versions.

    Cheers

  26. eleanorb
    Member
    Posted 1 year ago #

    What section of 'Add HTML/CSS inserts' do you add this? (I see five places to add.) In CSS Inserts? (the largest)

  27. infrcl
    Member
    Posted 1 year ago #

    Yes, in the 'CSS Inserts' section.

  28. eleanorb
    Member
    Posted 1 year ago #

    Oh, wonderful! That fixed it for me, so I can now go back to using Relevanssi. Thank you so much!!

  29. eleanorb
    Member
    Posted 1 year ago #

    Okay, more trouble. That fix works fine in my online version (WP 3.0.5, Relevanssi 3.1.4. But I need to upgrade the WP version, so I'm testing that on my local site (now WP 3.5.1, Relevanssi 3.1.4) and it does not work, either with or without the patch.
    Search for Hynes at olderwomensnetwork.org to see the live, good but old, version. The upgraded local version looks like this: -- No "More" wording at all!

    OWN maintains a close relationship with certain other organizations, sending a representative to their meetings on a regular basis. These organizations are: Ontario Coalition of Senior Citizens’ Organizations (OCSCO) — OWN rep., Mary Hynes A coalition of organizations and individuals from across Ontario, OCSCO has been advocating for seniors’ issues for 25 years. Mary is currently secretary of their Board of Directors. Ontario Seniors’ Secreta . . . … . . .

    Any ideas? Now I'm reluctant to upgrade the live site...

  30. eleanorb
    Member
    Posted 1 year ago #

    Actually, there are other differences -- no title, comments appear open, different selection of items, etc. Big problems...

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic