• whiteorb

    (@whiteorb)


    I use the popular plugin wp-table-reloaded to give my internal users the ability to create pre-formatted tables. It’s excellent and well thought out. Has anyone tried to find a way to index the data after it’s been added to the page?

    I have an example at the bottom of this page.

    Thanks a ton!

Viewing 15 replies - 1 through 15 (of 17 total)
  • WP Table Reloaded is one of the best plugins ever. There’s a problem with it and Relevanssi, though… I was doing some advanced hacking with WP Table recently and I found out the shortcodes WP Table uses aren’t even registered on the admin side of WordPress.

    So, when Relevanssi does the indexing and tries to expand the table shortcodes, nothing happens. I had to take some extra turns and twists to make it work, and I’m not sure if that’s something that can work in Relevanssi. I’ll have to see if it’s possible to make the two plugins work together, it would be neat.

    Thread Starter whiteorb

    (@whiteorb)

    I’ll happily hack anything and wait for the official fix. Would you mind walking me through the steps?

    Thread Starter whiteorb

    (@whiteorb)

    I also posted the question to his thread

    The trick is to include the WP Table code:

    include_once(WP_TABLE_RELOADED_ABSPATH . 'controllers/controller-frontend.php');
    $My_WP_Table_Reloaded = new WP_Table_Reloaded_Controller_Frontend();

    Do this before indexing… you could try adding this to relevanssi_build_index() function.

    TobiasBg

    (@tobiasbg)

    Hi,

    this is indeed a tricky thing. msaari is right, WP-Table Reloaded does not register its Shortcodes on the admin side (as there’s usually no need for them there).

    If something requires them however, one can change this behavior, by either using msaari’s suggestion, or by adding a small change to the main file of WP-Table Reloaded, namely wp-table-reloaded.php. It should be enough to remove the else { (after the } which needs to stay) in line 58 and the closing bracket for this else in line 120.

    Best wishes,
    Tobias

    Thread Starter whiteorb

    (@whiteorb)

    This is great, thank you both very much. I was trying to determine how to add $MY_WP_Table_Reloaded to the relevanssi_build_index function and I seem to have a knack for breaking it. I think I’m simply confused by why where it needs to go.

    I went ahead and removed the else and it’s corresponding brackets, rebuilt the index, and verified. It didn’t seem to index any data from within the table(s). You can see that here.

    The code needs to be included before the relevanssi_index_doc() function processes the documents, but only once should be enough. Thus relevanssi_build_index().

    Have you enabled expanding the shortcodes in Relevanssi settings?

    Thread Starter whiteorb

    (@whiteorb)

    I went ahead and added the code to the relevanssi_build_index function. Expand shortcodes is set on. and I’ve removed the else from wp-table-reloaded. It doesn’t seem to be indexing any of the table data though.

    function relevanssi_build_index($extend = false) {
    	include_once(WP_TABLE_RELOADED_ABSPATH . 'controllers/controller-frontend.php');
    	$My_WP_Table_Reloaded = new WP_Table_Reloaded_Controller_Frontend();
    
    	global $wpdb, $relevanssi_table;
    	set_time_limit(0);

    Well, if that doesn’t work, I’m out of ideas.

    I realized that my site was having the same problem, and stumbled on this post. Did anyone ever find a way to make the two plugins work?

    I did find something of a work-around(with some results) by adding a custom field to each page where I had inserted a table. I could then copy all the text from my table and drop it in the field on each page. By including it in the Indexing Options, the search results started picking up these pages.

    What was surprising is that in the excerpt, it shows all the data straight from the table (as a long messy paragraph with no line breaks, of course), including text that I had removed when pasting it to the custom field. So, for example, in the excerpt, you see:

    ImageItem/DescriptionMSRPEducation Price Drop-In Ceiling Projector MountPerfect projector mounting for suspended ceilingsAVM-PRO-DCP-UNV202-SVSilverAVM-PRO-DCP-UNV202-BKBlack$160.00$160.00$99.00$99.00

    I don’t know if this helps at all for coming up with a solution of sorts, but I thought I’d post what I found.

    I was able to make msaari’s code shown above work with WP-Table_reloaded and it does search the table data.
    I added the code to the relevanssi_build_index() function and I did not need to make any changes to WP_Table_Reloaded.
    I had to Build the index before search would search the tables, however.

    Hi,

    thanks for sharing this! Good to hear that this works so easily!

    Best wishes,
    Tobias

    This thread just saved my skin!

    I noticed however that this only searches within table content and NOT within th tags. Is there a way to search th as well?

    Thanks!

    Hi,

    are you sure about that?

    I’m not familiar with the way Relevanssi works, but I don’t see a way that it would only search within <td> tags…

    Regards,
    Tobias

Viewing 15 replies - 1 through 15 (of 17 total)
  • The topic ‘[Plugin: Relevanssi] Indexing wp-table-reloaded with relevanssi’ is closed to new replies.