Articles of excerpt

Apply wordpress filter checking category

I am trying to apply wordpress filter hook get_the_expert. My intention is to apply filter only when the category slug is “MY-CATEGORY-SLUG”. How can I check the category slug inside the filter hook function. Thanks

How to get rid of Ellipsis on Woocommerce Theme

As the picture says I am trying to remove the three dots that follow the end of the blue sentence (shown in the photo). I am also trying to increase the numbers of characters it can reveal. Furthermore, for some reason, the blue text shows “&” and “&nspb” symbols at the end of some excerpts, […]

Excerpt for pages not showing

I am creating a simple wordpress theme and need excerpts for pages. I have tried the code from many topics some resolved on ‘wordpress SO’ but nothing works. Because I created the theme from scratch I added a blank functions.php file and put the following code in it. add_action( ‘init’, ‘my_add_excerpts_to_pages’ ); function my_add_excerpts_to_pages() { […]

How to Get Shortcode in Excerpt to follow Document Flow

I have the following Post – Excerpt: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam sagittis augue sed orci efficitur convallis at sit amet lectus. [my-short-code] I have the following in my functions.php file: function getMyShortCode_func() { echo ‘<div class=”abc”>Hello world.</div>’; } // end getMyShortCode_func() add_filter(‘the_excerpt’, ‘shortcode_unautop’); // prevents shortcodes from being auto wrapped […]

Post class only applying to first excerpt; why?

I have a page with three excerpts. Only the first excerpt is being given the post class, not the second or third. I presume something is wrong in my PHP: <table width=”100%” border=”0″ cellspacing=”0″ cellpadding=”0″ align=”center”> <tr> <td width=”100%” valign=”top”> <div id=”post-<?php the_ID(); ?>” <?php post_class(); ?>> <?php if ( have_posts() ) : while ( […]

Private Post BUT Public excerpt on Homepage

I’m building a website for a french school. My problem : part of the website content will be private. Me and some other specified users will publish private posts (posts that only the 600 already-registred users will be abble to see). But an excerpt of those posts (small photo+some text) shall be visible to any […]

My post excerpt does not work

I’m using the excerpt for post but when I click on the read more link it does not show me all post paragraph and it show me only the paragraph excerpted and this the code line index.php <?php if ( have_posts() ) : ?> <?php while ( have_posts() ) : the_post(); ?> <?php get_template_part( ‘content’, […]

Limiting the number of characters in the except

I am trying to post a news blog section on my home page, but I want to limit the text to 100 characters. I am using this code in the functions.php file but it is not working. I want to limit the amount of character from my blog post. I am using this code in […]

Modify WP_Post before processing

I am looking for a way to modify WP_Post object before it’s processed and displayed on the page. Reason – I built my site when WP was still in version 2.0, or even earlier. I didn’t attend to it for a couple of years, but now I’m back making updates. First version of my site […]

How to properly show the Excerpt only if it exists?

I have the following two functions in my theme: function content($limit) { global $post; $content = explode(‘ ‘, get_the_content(), $limit); if (count($content)>=$limit) { array_pop($content); $content = implode(” “,$content); $content = wp_strip_all_tags($content, true); } else { $content = implode(” “,$content); } $content = preg_replace(‘/\[.+\]/’,”, $content); $content = apply_filters(‘the_content’, $content); $content = str_replace(‘]]>’, ‘]]&gt;’, $content); return $content; […]