New answers tagged

0

If you are simply trying to echo the excerpt in a specific part of a theme, you can simply use the following code within the loop: <?php $excerpt = get_the_excerpt(); echo substr( $excerpt, 0, 15 ) . '&hellip;'; ?> If you want to filter the excerpt globally (in archives, blog pages, etcetera) to match any post part of one or more ...


0

Put the following code in your functions.php function excerpt($limit) { $excerpt = explode(' ', get_the_excerpt(), $limit); if (count($excerpt)>=$limit) { array_pop($excerpt); $excerpt = implode(" ",$excerpt).'...'; } else { $excerpt = implode(" ",$excerpt); } ...


0

Instead of trying to do this through the orderby parameter, I went a different direction. Logically, the orderby parameter above only applies to the posts within each grouping, not the taxonomy term grouping itself so it won't work for this. What I ended up doing was adding 01, 02, 03, etc. to the taxonomy term name itself, then stripped that out using ...


2

Inside get_posts() method of the WP_Query class (line 3769), you will find out this filter: $this->posts = apply_filters_ref_array( 'the_posts', array( $this->posts, &$this ) ); It's the very first hook you can use to modify queried posts on both back-end and front-end. $this->posts is an array of queried posts so it's easy to modify the ...


2

I am not familiar with the plugin, but it seems unlikely that the $conditions array you're adding to should contain any variety of WordPress query arguments. Further, referencing the $conditions array within a property that you're setting on that very array won't contain the new data you've added, but rather the array as it existed before your additions ...


0

I think you might be jumping the gun with actively discarding the data here. What if next month trolls go away, you change your mind, and want all those featured images back? I would just suppress them on front end by editing template and making thumbnail output conditional or filtering API with something like this: if ( ! is_admin() ) { add_filter( ...



Top 50 recent answers are included