نجح الأمر بشكل جيد! شكرًا مرة أخرى على الدعم
الآن أريد إضافة نص المنشور المخفي داخل الموضوع ليتم العثور عليه بواسطة وظيفة البحث وجمعه بشكل صحيح من قبل عناكب محركات البحث.
ما التغييرات التي يجب علي إجراؤها على الكود الحالي أدناه لإضافة <div style="display:none;">...</div> يحتوي على محتوى المنشور؟
// يزيل أي شيء يبدو أنه اختصار قصير. سيؤدي هذا إلى إزالة أي شيء في المنشور
// يظهر داخل الأقواس `[...]`.
add_filter( 'wp_discourse_excerpt', 'testeleven_remove_shortcodes' );
function testeleven_remove_shortcodes( $excerpt ) {
$excerpt = preg_replace( '/\[.*\]/', '', $excerpt );
return $excerpt;
}
// إظهار منشورات ووردبريس المضمنة في ديسكورد عبر iframe
// https://meta.discourse.org/t/wp-discourse-how-to-deal-with-shortcodes-in-post/58838/5
add_filter( 'discourse_publish_format_html', 'wpdc_custom_discourse_publish_format_html', 10, 2 );
function wpdc_custom_discourse_publish_format_html( $output, $post_id ) {
$permalink = get_the_permalink( $post_id );
ob_start();
?>
<iframe width="690" height="2000" src="<?php echo esc_url( $permalink ); ?>" frameborder="0"></iframe>
<?php
return ob_get_clean();
}