• Resolved synthesiamaniac

    (@synthesiamaniac)


    What an awesome plugin!

    I am having an issue with the index pulling file size data from a list of files on my downloads page. The filename is on one column and the file size is in another column. Is it possible to have the plugin only scan the first column while building the index so that the file size does not show up? Or is there a way to filter that out of the excerpt.

    Also, from the data on these pages is it possible to format the excerpt so it looks more like a list. For example:

    Instead of this:
    …Bad Day – Daniel Powter 59.9 Kb Beatles – Let It Be 30.56 Kb Beatles…

    Format like this:
    Bad Day – Daniel Powter
    Beatles – Let It Be
    Beatles…

    It would look a lot neater for the information that is stored in tables on my site… which happens to be a majority of the data.

    Thank you so much!

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Mikko Saari

    (@msaari)

    Relevanssi doesn’t understand what your data is. It just takes whatever it sees, strips the formatting and presents it.

    Your data is structured well, so it’s not a difficult task to improve the indexing. Just add this to your theme functions.php:

    add_filter( 'relevanssi_post_content', 'rlv_filesize' );
    function rlv_filesize( $content ) {
    	$content = preg_replace( '#<td class="filesize".*?</td>#', '', $content );
    	return $content;
    }

    Now when you rebuild, the file size columns are not indexed anymore.

    It doesn’t help you with the excerpts, though. There, you can get pretty close by adding this to your theme functions.php:

    add_filter( 'relevanssi_excerpt_content', 'rlv_excerpt', 10, 2 );
    function rlv_excerpt( $content, $post ) {
    	$content = preg_replace( '#<td class="filesize".*?</td>#', '<br />', $content );
    	return $content;
    }

    Again, this removes the file size columns, but now they are not completely removed, but instead are replaced with a line-break. Now if you add <br> to the list of allowed tags on the Relevanssi excerpt settings tab, you’re pretty close for what you’re looking for, I think.

    If you like Relevanssi and appreciate my help, it would help me a lot if you could leave a review for Relevanssi. Thanks!

    Thread Starter synthesiamaniac

    (@synthesiamaniac)

    You are amazing! That works perfectly and the format is exactly what I was looking for. Thank you so much!

    I will definitely be leaving a review of Relevanssi.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Index One Column of Table’ is closed to new replies.