Modifying no-post content


Hi everybody,

What would be the best approach to replace the default "Whoops, ...." phrase and the search bar with custom content?

Thanks in advance Marcel


Filter the original text with another translable text.

Put this code somewhere in your functions.php file.

// Add filter with anonymous function.
beans_add_filter(
  'beans_no_post_article_title_text_output',
    __( 'Your awesome text to display if no post are shown', 'your-text-domain' )
);

Hi Joseph,

thanks for your reply. I already figured out how to change the output text, but I'm looking for a method to remove the headline and more importantly remove the search form because in this case it's not needed.

I've already tried

beans_remove_action( 'beans_post_title' );

and

beans_remove_action( 'beans_post_header' );

in my custom post type template but it didn't work and since the search form has no beans data-markup-id, I have no clue how to approach the problem.

Any other suggestions?


Now i understand.

Every part of Beans contains a callback, the post title, the post content, the comment title, the loop, etc... With the Markup API you can modify a single markup, but with Actions API you can modify a part of the theme or maybe entire theme.

Create a new function to replace the default beans_no_post(). Then tell the action to call your new function instead of beans_no_post().

beans_modify_action_callback( 'beans_no_post', 'my_new_no_post' );
/*
 * New callback template to replace the default 'beans_no_post'.
 */
function my_new_no_post() {

  // Your code goes here.

}

that's indeed working like a charm. Thanks a lot!

Write a reply

Login or register to write a reply, it's free!