Hi,
I have removed the author from the meta in on the single article page with this:
beans_add_filter( 'beans_post_meta_item_author_text_output', 'author_name' );
function author_name() {
return '';
}
The author does not show but || is still visible, how can I remove that?
Hey Bas, this is because you are only removing the content and not the actual <li></li>
HTML tag. Your code should be as follow:
// Remove the meta author content.
add_filter( 'beans_post_meta_item_author_text_output', '__return_false' );
// Remove the meta author wraping html tag.
beans_remove_markup( 'beans_post_meta_item_author' );
In your example you are adding a callback to return and empty output, in mine I use __return_false
callback which is a WP core function which simple returns false. It is just a shortcut but does the same.
If you would like to dive a bit deeper, there is a filter called beans_post_meta_items
which controls Beans post meta. It allows you to easily add, remove or re-order metas. In your case, your code would be as follow:
add_filter( 'beans_post_meta_items', 'beans_child_remove_post_meta_items' );
function beans_child_remove_post_meta_items( $items ) {
unset( $items['author'] );
return $items;
}
Hope that helps,
Thanks Thierry,
I also like the beans_post_meta_items
too.
Great, glad to hear you like beans_post_meta_items
, it is very handy 🙂
Is it possible to remove post meta just for pages, leaving it intact on posts?
Hello Kim,
There are a few ways to accomplish this.
You can install and use query monitor - https://github.com/johnbillion/query-monitor#theme
Then make the modifications on the approrate page template file or post template file.
Hope that helps.
Cheers, Maurice