@pettera
It is the same post. But as you can see tthe second post is displayed with the category name, and the category slug at the end of the url.
Get WPFTS Pro today with 25% discount!
[Solved] Search PDF by content in Real3D FlipBook Plugin
-
Recently we faced a great plugin to display PDF files in a fancy way - like a paper magazine! It's the Real3D Flipbook plugin, which is awesome! However it also has the same problem - users are not possible to search PDF documents uploaded to the Real3D FlipBook by the content.
Fortunately, it is also simple to fix with the WPFTS Pro.
add_filter('wpfts_index_post', function($index, $p) { global $wpdb, $wpfts_core; if (in_array($p->post_type, array('post', 'page'))) { global $post; if (preg_match_all('~\[real3dflipbook((\s+[^\]]*)|(\]))\]~sU', $p->post_content, $zz, PREG_OFFSET_CAPTURE)) { // 1 is a shortcode params // 0 is a whole shortcode tag require_once $wpfts_core->root_dir.'/includes/wpfts_utils.class.php'; $sum = ''; foreach ($zz[1] as $k => $d) { if (isset($d[0])) { $zz2 = array(); if (preg_match('~id=[\x22\x27]?(\d+)~', $d[0], $zz2)) { $bookid = $zz2[1]; // Look for data $ff = get_option('real3dflipbook_'.$bookid); if ($ff && (is_array($ff))) { if (isset($ff['pdfUrl'])) { $url = trim($ff['pdfUrl']); if (strlen($url) > 0) { $ret = WPFTS_Utils::GetCachedFileContent_ByLocalLink($url); $sum .= (isset($ret['post_content']) ? trim($ret['post_content']) : '').' '; } } } } } } $index['real3dflipbook_content'] .= $sum; /* $content = $p->post_content; // Remove the pdfviewer shortcodes for ($ii = count($zz[0]) - 1; $ii >= 0; $ii --) { $content = substr($content, 0, $zz[0][$ii][1]).substr($content, $zz[0][$ii][1] + strlen($zz[0][$ii][0])); } $index['post_content'] = $content; */ global $shortcode_tags; $removed_tmp = array(); $shortcode_list = array('real3dflipbook'); foreach ($shortcode_list as $dd) { if (isset($shortcode_tags[$dd])) { $removed_tmp[$dd] = $shortcode_tags[$dd]; // Save shortcode function unset($shortcode_tags[$dd]); } else { $removed_tmp[$dd] = false; } add_shortcode($dd, function(){ return ''; }); // Dummy function to render empty string for shortcode } $post = get_post($p->ID); setup_postdata($post); ob_start(); the_content(); $r = ob_get_clean(); $r = strip_tags(str_replace('<', ' <', $r)); // Okay, we need to restore shortcodes foreach ($removed_tmp as $k => $d) { if ($d) { $shortcode_tags[$k] = $removed_tmp[$k]; } else { unset($shortcode_tags[$k]); } } wp_reset_postdata(); $index['post_content'] = $r; } } return $index; }, 3, 2);
Well, the code is not that simple, but if you just want to have it works,
download the ready addon!https://fulltextsearch.org/wpfts-addon-real3dflipbook-1.0.0.zip