• Resolved Zane Duncan

    (@zjduncan2007)


    Hello! I hope this message finds you well. I am needing to establish connections so that Relevanssi can index the contents of my DFlip flipbooks. When I go into the settings page, it give me a checkbox as to weather or not I would like to index the books, however it is excluding it from the indexing process. I have went and unchecked the box to force it to include it and hit save. When it saves, it reverts back to excluding it. I was wondering if there was another way to have Relevanssi index these contents. I stumbled across this page, but the plugin I use doesn’t seem to be listed. Thank you in advance for your help!

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

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

    (@msaari)

    I added DearFlip to the list. Here’s the code for it:

    add_filter( 'relevanssi_content_to_index', 'rlv_dearflip_content', 10, 2 );
    function rlv_dearflip_content( $content, $post ) {
    $m = preg_match_all( '/\[dflip.*?id=["\'](.*?)["\']/', $post->post_content, $matches );
    if ( $m ) {
    global $wpdb;
    $upload_dir = wp_upload_dir();
    foreach ( $matches[1] as $flipbook_id ) {
    $data = get_post_meta( $flipbook_id, '_dflip_data', true );
    $pdf_url = ltrim( str_replace( $upload_dir['baseurl'], '', urldecode( $data['pdf_source'] ) ), '/' );
    $pdf_content = $wpdb->get_var( $wpdb->prepare( "SELECT meta_value FROM $wpdb->postmeta WHERE meta_key = '_relevanssi_pdf_content' AND post_id IN ( SELECT post_id FROM $wpdb->postmeta WHERE meta_key = '_wp_attached_file' AND meta_value = %s )", $pdf_url ) );
    $content .= $pdf_content;
    }
    }
    return $content;
    }

    However, this doesn’t work in the free version of Relevanssi because you need Relevanssi Premium to index the PDF contents.

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.