-
Hello!
My issue is
Not generating descriptions with %excerpt%
I tried these ways
——–
/*
* A simple function to control the number of Twenty Seventeen Theme Front Page Sections
* Source: wpcolt.com
*/
function wpc_custom_front_sections( $num_sections )
{
return 20; //Change this number to change the number of the sections.
}
add_filter( ‘twentyseventeen_front_page_sections’, ‘wpc_custom_front_sections’ );add_filter( ‘rank_math/frontend/description’, function( $description ) {
if ( is_singular( ‘listings’ ) ) {
//global $post;
$value = RankMathHelper::get_settings( ‘titles.pt_listings_description’ );
return ” !== $value ? RankMathHelper::replace_vars( $value, [] ) : ”;}
return $description;
});——–
/**
* Allow changing the meta description sentence from within the theme. 20200626 133736
*
* @param string $description The description sentence.
*/
add_filter( ‘rank_math/frontend/description’, function( $description ) {
return $description;
});add_action( ‘rank_math/frontend/description’, function( $description ) {
if ( ! is_singular() ) {
return $description;
}global $post;
$desc = RankMathPost::get_meta( ‘description’, $post->ID );if ( $desc ) {
return $desc;
}if ( empty( $post ) || empty( $post->post_content ) ) {
return $description;
}$keywords = RankMathPost::get_meta( ‘focus_keyword’, $post->ID );
$post_content = RankMathPaperPaper::should_apply_shortcode() ? do_shortcode( $post->post_content ) : $post->post_content;
$post_content = preg_replace( ‘/<!–[sS]*?–>/iu’, ”, $post_content );
$post_content = wpautop( $post_content );
$post_content = wp_kses( $post_content, [ ‘p’ => [] ] );// 4. Paragraph with the focus keyword.
if ( ! empty( $keywords ) ) {
$regex = ‘/<p>(.*’ . str_replace( [ ‘,’, ‘ ‘, ‘/’ ], [ ‘|’, ‘.’, ‘/’ ], $keywords ) . ‘.*)</p>/iu’;
preg_match_all( $regex, $post_content, $matches );
if ( isset( $matches[1], $matches[1][0] ) ) {
return $matches[1][0];
}
}// 5. The First paragraph of the content.
preg_match_all( ‘/<p>(.*)</p>/iu’, $post_content, $matches );
return isset( $matches[1], $matches[1][0] ) ? wp_html_excerpt( $matches[1][0], 160 ) : ”;
});/*
* Code to check the meta description that is set on the Rank Math
* Titles & Meta > Factoring listing description and return it
* for single listings
*/
add_filter( ‘rank_math/frontend/description’, function( $description ) {
if ( is_singular( ‘listings’ ) ) {
//global $post;
$value = RankMathHelper::get_settings( ‘titles.pt_listings_description’ );
return ” !== $value ? RankMathHelper::replace_vars( $value, [] ) : ”;}
return $description;
});
——–https://rankmath.com/kb/filters-hooks-api-developer/#change-meta-description
——-
Can you help me?Thank you!
-
Hello,
Thank you for contacting Rank Math and sorry for any inconvenience that might have been caused due to that.
We might need to take a closer look at the settings. Please edit the first post on this ticket and include your WP logins in the designated Sensitive Data section.
It is completely secure and only our support staff has access to that section. If you want, you can use the below plugin to generate a temporary login URL to your website and share that with us instead:
https://wordpress.org/plugins/temporary-login-without-password/
You can use the above plugin in conjunction with the WP Security Audit Log to monitor what changes our staff might make on your website (if any):
https://wordpress.org/plugins/wp-security-audit-log/
We really look forward to helping you.
Hello,
I have updated the sensitive data as requested. Can you please check further?
Thank you.
Hello,
I have checked your site and created a test page but I couldn’t replicate the issue. Please note that the meta description will only take an excerpt of you page/post if the description field is empty. I have attached a screencast in the sensitive section, please check and let us know if there is something we are missing.
Looking forward to helping you. Thank you.
Hello, Michael Davis!
Thank you for test!
It seem that descriptions generating now.Hello,
We are super happy that this resolved your issue. If you have any other questions in the future, know that we are here to help you.
If you don’t mind me asking, could you please leave us a review (if you haven’t already) on https://wordpress.org/support/plugin/seo-by-rank-math/reviews/#new-post about your overall experience with Rank Math? We appreciate your time and patience.
If you do have another question in the future, please feel free to create a new forum topic, and it will be our pleasure to assist you again.
Thank you.
Thank you for support!
I wrote 5 stars review for RankMath!Hi Eidos,
Thank you so much.
We really appreciate it.
The ticket ‘Not generating descriptions with %excerpt%’ is closed to new replies.