• Resolved mixette

    (@mixette)


    I have created a few series and a book grid to display all series grouped, but the title of each series displays as “Series: name of the series”. I would like to display the name of the series only.
    I found a filter from a few years ago here on the forum, but that code doesn’t work anymore.

    add_filter('mbdb_book_grid_mbdb_series_title', 'mbdb_change_series_page_title', 10, 3);
    function mbdb_change_series_page_title($title, $term, $taxonomy) {
        return $taxonomy->labels->singular_name .' '. $term->name;
        }

    How to display the name of the series only?

    I also added a description for each series. Is it possible to display this as well?

    Thanks, Britt

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author mooberrydreams

    (@mooberrydreams)

    The following code should give you what you want. You will need to add this to the functions.php file of your child theme, or in a custom plugin that you create.

    add_filter('mbdb_book_grid_heading', 'mbdb_change_series_grid_header');
    function mbdb_change_series_grid_header($header) {
    	return str_replace('Series: ', '', $header);
    }
    Plugin Author mooberrydreams

    (@mooberrydreams)

    Adding the description was a little more involved. First you will have to update to MBM 4.4.4.

    Then you can add this code. Note that it will only work in conjunction with the above code (ie, if you choose to add the “Series: ” back in, this code will not work)

    add_filter('mbdb_book_grid_post_heading_content', 'mbdb_add_after_grid_header', 10, 3);
    function mbdb_add_after_grid_header( $content, $l, $label) {
    
    		$taxonomies = MBDB()->book_CPT->taxonomies;
    		foreach ( $taxonomies as $name => $taxonomy ) {
    			$term = get_term_by( 'name', $label, $taxonomy->slug );
    			if ( $term !== false ) {
    				$description = term_description($term->term_id);
    				$content .= '<span class="mbdb_taxonomy_description">' . $description . '</span>';
    			}
    		}
    		return $content;
    }

    You can change how it displays by added CSS to the class mbdb_taxonomy_description

    • This reply was modified 4 years, 3 months ago by mooberrydreams. Reason: added CSS info
    Thread Starter mixette

    (@mixette)

    Thanks a lot!! It’s working!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘change titel and add description of series in book grid’ is closed to new replies.