mrctulio
Forum Replies Created
Viewing 4 replies - 1 through 4 (of 4 total)
-
Nope. I’ll further debug. Thank you so much for support!
Just to make sure there is no errors.
I’m sorry. I’ve made a mistake copying the code. Indeed, the return clause is placed after the brace, and this is the condition the errors ocurr.
Please note that I’ve got a sucessfull indexing when I commented out the “IES” try-catch snippet (and also the other 3 try-catch queries). Even though this successful indexing was achieved by restarting (adding non indexed posts) after an initial halt.
Here it is:
add_filter( 'relevanssi_content_to_index', 'zy_add_fields_from_custom_table', 10, 2 ); function zy_add_fields_from_custom_table( $content, $post ) { if ( 'radio' == $post->post_type ) { /** * @param $content = conteúdo a ser indexado com os termos e palavras separados por um espa?o em branco */ $id = $post->ID; global $wpdb; // zy_global $data = $wpdb->get_row( "SELECT * FROM zy_global WHERE id = {$id}" , ARRAY_A ); $zid = $data['zid']; $estacao_id = $data['estacao_id']; if ( $data ) { $values = array_values($data); $content .= ' ' . implode(' ', $values); } /** * There are 3 other similar queries here in ... */ // IES try { $data = $wpdb->get_row( "SELECT * FROM zy_cobertura_economia WHERE id_canal = {$estacao_id}", ARRAY_A ); $zy_lista = json_decode($data['lista_ies'], true); foreach ($zy_lista as $item) { $content .= ' ' . $item['sigla'] . " " . $item['nome']; } } catch (Exception $e) { } return $content; } }
Viewing 4 replies - 1 through 4 (of 4 total)