Tag Info

New answers tagged

0

add_filter( 'excerpt_length', function($length) { return 400; }, 999 ); add_filter('excerpt_more', function($more) { return ''; }); another edit: this will cut words at the end, not in the middle of some word. I'm sorry if I understood the request wrong. And be free to change 400 to any amount of words you want to show. add that to your functions.php ...


0

You can get an array of child pages using get_children. Use the parent page's ID as post_parent. Once you have the array, you can loop through them and display whatever info you want. For example, to show the page title (linked) and the excerpt you could do: $args = array( 'post_parent' => $post -> ID ); $children = get_children( $args ); if( ...


0

You might be interested in fetching the post's link. get_permalink() and the_permalink() are the functions that returns the URL of current post, if that is what you want.


0

You can use the built in function function custom_excerpt_length( $length ) { return 20; } add_filter( 'excerpt_length', 'custom_excerpt_length', 999 ); http://codex.wordpress.org/Function_Reference/the_excerpt


0

Atlast i found the solution, it was very silly mistake. It got nothing to do with plugin or theme or any code. It was one of the WordPress settings which i didn't realize. Following pic shows the option to switch between excerpt view and list view of posts in wordpress. I by mistake selected excerpt view and thought it was a bug. Thanks for Pieter Goosen ...


0

Simply it can be done as below . function custom_excerpt_length( $length ) { return 20; } add_filter( 'excerpt_length', 'custom_excerpt_length', 999 ); Reference: Codex


1

Use the excerpt_more filter: function wpse_180792_excerpt_more() { return ''; } add_filter( 'excerpt_more', 'wpse_180792_excerpt_more' );


0

Took me a couple of blind tries, but I got it. Before: <a class="view-article" href="' . get_permalink($post->ID) . '">' . __('View Article', 'html5blank') . '</a>'; After: <a data-toggle="modal" data-target="#modal-' . $post->ID . ' " class="over">' . __('View Article', 'html5blank') . '</a>'


1

Shortcode's callback should return a string, not echo it. function getMyShortCode_func() { return '<div class="abc">Hello world.</div>'; }


2

I think that the function you need is wp_trim_excerpt. With this function you can generate a excerpt from any text: $text = "Some context"; $excerpt = wp_trim_excerpt( $text ); It is important to note that wp_trim_excerpt use the excerpt length set by WordPress, that is 55 words by default, and make use of excerpt_lenght filter, so it will work with any ...


0

Ok this was a rather simple answer. It appears that once you add the code you have to expand the screen options and enable it in the actual admin view. This link is what helped me Function Reference/add post type support.



Top 50 recent answers are included