Hide or Show Read More Button by Content Area

This checks the number of characters and hide the button server-side in content.php: <?php $excerpt = get_the_excerpt(); $excerpt_length = strlen($excerpt); $excerpt_limit = 100; // Match the limit set in functions.php // only for debugging: var_dump($excerpt); var_dump($excerpt_length); ?> <div class=”news-main”> <?php the_excerpt(); ?> </div> <?php if ($excerpt_length >= $excerpt_limit) : ?> <div class=”news-read”> <a href=”<?php echo … Read more

change read more text in archive page depending on post category

With the online php generator I’ve created this code snippet. $post_categories = get_the_category($post->ID); $parent_category_name=””; if (!empty($post_categories)) { $parent_category = $post_categories[0]->parent ? get_category($post_categories[0]->parent) : $post_categories[0]; $parent_category_name = $parent_category->name; } if ($parent_category_name === ‘Apple’ || $parent_category_name === ‘Strawberry’) { echo “<span>Apples &amp; Strawberries</span>”; } else { echo “<span>Fruits</span>”; } It really works fine for me.

Only show read more text when when wp:post-excerpt meets excerptLength

To override the behavior of the render_block_core_post_excerpt function in a Block Theme, especially to customize the “Read More” link behavior based on the excerptLength, you’ll need to unregister the original block and register your own customized version of it. This process involves a few steps: Deregister the Original Block: You need to deregister the original … Read more

why more tag is not working in my wordpress site

The <!–more–> tag is a replacement for an excerpt. You want to use the excerpt or <!–more–> tag on you blog/archive page, NOT on single posts. The <!–more–> tag will not work on a single post like this: https://igntimes.com/20-amazing-youtube-tricks-and-tips/ However, it should work on the blog (in your case your homepage, https://igntimes.com/. But you only … Read more

Read more button not working

From the Codex: Excerpts (teasers) can be shown on WordPress through two methods: The first, keeping the the_content() template tag and inserting a quicktag called more at your desired “cut-off” point when editing the post. The second, by replacing the the_content() template tag with the_excerpt(). If one of those conditions is met, and you are … Read more

Search results highlight breaks my read more link

Try this. function search_excerpt_highlight() { $excerpt = get_the_excerpt(); $keys = implode(‘|’, explode(‘ ‘, get_search_query())); $excerpt = preg_replace(‘/(‘ . $keys .’)/iu’, ‘<ins class=”search-highlight”>\0</ins>’, $excerpt); echo ‘<p>’ . $excerpt . ‘&hellip;’ . supralegal_read_more_link() . ‘</p>’; } function supralegal_auto_excerpt_more( $more ) { return ”; } add_filter( ‘excerpt_more’, ‘supralegal_auto_excerpt_more’ ); function supralegal_read_more_link() { return ‘ <a href=”‘. esc_url( get_permalink() … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)