forked from christiespeich/Mooberry-Book-Manager
-
Notifications
You must be signed in to change notification settings - Fork 0
/
book-grid.php
666 lines (578 loc) · 22.2 KB
/
book-grid.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
<?php
/**
* This file handles the meta boxes for the book grid settings on pages
* as well as retrieving the daa for and displaying the book grid
*
*/
/*******************************************************************
META BOXES
******************************************************************/
/**
* Creates metabox to be added to pages for book grids
*
*
*
* @since 1.0
*
* @access public
*/
add_filter( 'cmb2_meta_boxes', 'mbdb_book_grid_meta_boxes' );
function mbdb_book_grid_meta_boxes( ) {
$mbdb_book_grid_metabox = new_cmb2_box( array(
'id' => 'mbdb_book_grid_metabox',
'title' => __('Book Grid Settings', 'mooberry-book-manager'),
'object_types' => array( 'page' ),
'context' => 'normal',
'priority' => 'default',
'show_names' => true)
);
$mbdb_book_grid_metabox->add_field( array(
'name' => __('Display Books on This Page?', 'mooberry-book-manager'),
'id' => '_mbdb_book_grid_display',
'type' => 'select',
'default' => 'no',
'options' => array(
'yes' => __('Yes', 'mooberry-book-manager'),
'no' => __('No', 'mooberry-book-manager'),
),
)
);
$mbdb_book_grid_metabox->add_field( array(
'name' => __('Books to Display', 'mooberry-book-manager'),
'id' => '_mbdb_book_grid_books',
'type' => 'select',
'options' => mbdb_book_grid_selection_options(),
)
);
$mbdb_book_grid_metabox->add_field( array(
'name' => __('Select Books', 'mooberry-book-manager'),
'id' => '_mbdb_book_grid_custom',
'type' => 'multicheck',
'options' => mbdb_get_book_array(),
)
);
$mbdb_book_grid_metabox->add_field( array(
'name' => __('Select Genres', 'mooberry-book-manager'),
'id' => '_mbdb_book_grid_genre',
'type' => 'multicheck',
'options' => mbdb_get_term_options('mbdb_genre'),
)
);
$mbdb_book_grid_metabox->add_field( array(
'name' => __('Select Series', 'mooberry-book-manager'),
'id' => '_mbdb_book_grid_series',
'type' => 'multicheck',
'options' => mbdb_get_term_options('mbdb_series'),
)
);
$mbdb_book_grid_metabox->add_field( array(
'name' => __('Select Tags', 'mooberry-book-manager'),
'id' => '_mbdb_book_grid_tag',
'type' => 'multicheck',
'options' => mbdb_get_term_options('mbdb_tag'),
)
);
$mbdb_book_grid_metabox->add_field( array(
'name' => __('Select Publishers', 'mooberry-book-manager'),
'id' => '_mbdb_book_grid_publisher',
'type' => 'multicheck',
'options' => mbdb_get_publishers('no'),
)
);
$mbdb_book_grid_metabox->add_field( array(
'name' => __('Select Editors', 'mooberry-book-manager'),
'id' => '_mbdb_book_grid_editor',
'type' => 'multicheck',
'options' => mbdb_get_term_options('mbdb_editor'),
)
);
$mbdb_book_grid_metabox->add_field( array(
'name' => __('Select Illustrators', 'mooberry-book-manager'),
'id' => '_mbdb_book_grid_illustrator',
'type' => 'multicheck',
'options' => mbdb_get_term_options('mbdb_illustrator'),
)
);
$mbdb_book_grid_metabox->add_field( array(
'name' => __('Select Cover Artists', 'mooberry-book-manager'),
'id' => '_mbdb_book_grid_cover_artist',
'type' => 'multicheck',
'options' => mbdb_get_term_options('mbdb_cover_artist'),
)
);
$group_by_options = mbdb_book_grid_group_by_options();
$count = count($group_by_options);
for($x=1; $x <$count; $x++) {
$mbdb_book_grid_metabox->add_field( array(
'name' => __('Group Books By', 'mooberry-book-manager'),
'id' => '_mbdb_book_grid_group_by_level_' . $x,
'type' => 'select',
'options' => $group_by_options,
)
);
// put a warning at the 5th level
if ( $x == 5 ) {
$mbdb_book_grid_metabox->add_field( array(
'name' => __('Warning: Setting more than 5 levels could cause the page to timeout and not display.', 'mooberry-book-manager'),
'type' => 'title',
'id' => '_mbdb_book_grid_warning',
'attributes' => array(
'display' => 'none'
)
)
);
}
}
$mbdb_book_grid_metabox->add_field( array(
'name' => __('Order By', 'mooberry-book-manager'),
'id' => '_mbdb_book_grid_order',
'type' => 'select',
'options' => mbdb_book_grid_order_options(),
)
);
$mbdb_book_grid_metabox->add_field( array(
'name' => __('Use default cover height?', 'mooberry-book-manager'),
'id' => '_mbdb_book_grid_cover_height_default',
'type' => 'select',
'default' => 'yes',
'options' => array(
'yes' => __('Yes','mooberry-book-manager'),
'no' => __('No','mooberry-book-manager'),
),
)
);
$mbdb_book_grid_metabox->add_field( array(
'name' => __('Book Cover Height (px)', 'mooberry-book-manager'),
'id' => '_mbdb_book_grid_cover_height',
'type' => 'text_small',
'attributes' => array(
'type' => 'number',
'pattern' => '\d*',
'min' => 50,
),
)
);
$mbdb_book_grid_metabox->add_field( array(
'name' => __('Additional Content (bottom)', 'mooberry-book-manager'),
'id' => '_mbdb_book_grid_description_bottom',
'type' => 'wysiwyg',
'description' => __('This displays under the book grid.', 'mooberry-book-manager'),
'options' => array(
'wpautop' => true, // use wpautop?
'media_buttons' => true, // show insert/upload button(s)
'textarea_rows' => 10, // rows="..."
'tabindex' => '',
'editor_css' => '', // intended for extra styles for both visual and HTML editors buttons, needs to include the `<style>` tags, can use "scoped".
'editor_class' => '', // add extra class(es) to the editor textarea
'teeny' => false, // output the minimal editor config used in Press This
'dfw' => false, // replace the default fullscreen with DFW (needs specific css)
'tinymce' => true, // load TinyMCE, can be used to pass settings directly to TinyMCE using an array()
'quicktags' => true // load Quicktags, can be used to pass settings directly to Quicktags using an array()
),
)
);
$mbdb_book_grid_metabox = apply_filters('mbdb_book_grid_meta_boxes', $mbdb_book_grid_metabox);
}
/****************************************************************************
GET DATA
*****************************************************************************/
/**
* Get the data and generate output content for the book grid
*
*
*
* @since 1.0
*
* @return content to be displayed
*
* @access public
*/
function mbdb_bookgrid_content() {
global $post;
$content ='';
$mbdb_book_grid_meta_data = get_post_meta( $post->ID );
// VALIDATE THE INPUTS
// loop through the group by levels
// set up the group arrays
// stop at the first one that is none
// if there is a series, add none after that and stop
$groups = array();
$current_group = array();
$group_by_levels = mbdb_book_grid_group_by_options();
for($x = 1; $x< count($group_by_levels); $x++) {
if (!array_key_exists('_mbdb_book_grid_group_by_level_' . $x, $mbdb_book_grid_meta_data) ) {
$groups[$x] = 'none';
$current_group['none'] = 0;
break;
}
$group_by_dropdown = $mbdb_book_grid_meta_data['_mbdb_book_grid_group_by_level_' . $x][0];
$groups[$x] = $group_by_dropdown;
$current_group[$group_by_dropdown] = 0;
if ( $group_by_dropdown == 'none' ) {
break;
}
if ($group_by_dropdown == 'series' ) {
$groups[$x+1] = 'none';
$current_group['none'] = 0;
break;
}
}
// set the sort
if (array_key_exists('_mbdb_book_grid_order', $mbdb_book_grid_meta_data)) {
$sort = mbdb_set_sort( $groups, $mbdb_book_grid_meta_data['_mbdb_book_grid_order'][0]);
} else {
$sort = mbdb_set_sort( $groups, 'titleA' );
}
// if selection isn't set, default to "all"
if (array_key_exists('_mbdb_book_grid_books', $mbdb_book_grid_meta_data) ) {
$selection = $mbdb_book_grid_meta_data['_mbdb_book_grid_books'][0];
} else {
$selection = 'all';
}
// turn selected_ids into an array
// or null if there aren't any
if (array_key_exists('_mbdb_book_grid_' . $selection, $mbdb_book_grid_meta_data)) {
$selected_ids = unserialize($mbdb_book_grid_meta_data['_mbdb_book_grid_' . $selection][0]);
} else {
$selected_ids = null;
}
// start off the recursion by getting the first group
$level = 1;
$books = mbdb_get_group($level, $groups, $current_group, $selection, $selected_ids, $sort, null);
// $books now contains the complete array of books to display in the grid
// get the display output content
$content = mbdb_display_grid($books, 0);
// find all the book grid's postmeta so we can display it in comments for debugging purposes
$grid_values = array();
foreach ($mbdb_book_grid_meta_data as $key => $data) {
if ( substr($key, 0, 5) == '_mbdb' ) {
$grid_values[$key] = $data[0];
}
}
$content = '<!-- Grid Parameters:
' . print_r($grid_values, true) . ' -->' . $content;
// add on bottom text
if (array_key_exists('_mbdb_book_grid_description_bottom', $mbdb_book_grid_meta_data)) {
$book_grid_description_bottom = $mbdb_book_grid_meta_data[ '_mbdb_book_grid_description_bottom'][0];
} else {
$book_grid_description_bottom = '';
}
return $content . $book_grid_description_bottom;
}
/**
* Return one group of books for the grid
* This is called recursively until the group "none" is found
*
* @since 1.0
* @since 3.0 re-factored
*
* @param [int] $level the nested level of the grid we're currently one
* @param [array] $groups the groups in grid
* @param [array] $current_group the id of the current group. Could be if of a
* series, genre, publisher, illustrator, etc.
* @param [string] $selection what selection of books for the grid ('all',
* 'unpublished', 'series', etc.)
* @param [array] $selected_ids ids of the selection
* @param [string] $sort represents sort, ie 'titleA', 'titleD',
* 'series, etc.
* @param [array] $book_ids optional list of book_ids to filter by, useful
* for add-on plugins to add on to grid (ie MA)
*
* @return array of books for this group
*
* @access public
*/
function mbdb_get_group($level, $groups, $current_group, $selection, $selected_ids, $sort, $book_ids) {
do_action('mbdb_book_grid_pre+get_group', $level, $groups, $current_group, $selection, $selected_ids, $sort, $book_ids );
$books = array();
$taxonomies = get_object_taxonomies( 'mbdb_book', 'objects' );
$tax_names = array_keys($taxonomies);
switch ( $groups[$level] ) {
// break the recursion by actually getting the books
case 'none':
$books = MBDB()->books->get_ordered_selection($selection, $selected_ids, $sort, $book_ids, $current_group );
break;
case 'publisher':
$books = mbdb_get_books_by_publisher($level, $groups, $current_group, $selection, $selected_ids, $sort, $book_ids );
break;
default:
// see if it's a taxonomy
// don't just assume it's a taxonomy because it could be
// that there's an add-on plugin (ie MA) that's added
// a new group
if (in_array('mbdb_' . $groups[$level], $tax_names)) {
$books = mbdb_get_books_by_taxonomy($level, $groups, $current_group, $selection, $selected_ids, $sort, $book_ids );
}
}
do_action('mbdb_book_grid_post_get_group', $level, $groups, $current_group, $selection, $selected_ids, $sort, $book_ids );
return apply_filters('mbdb_book_grid_get_group_books', $books, $level, $groups, $current_group, $selection, $selected_ids, $sort, $book_ids );
}
/**
* Get books by publisher
*
* @since
* @param [int] $level the nested level of the grid we're currently one
* @param [array] $groups the groups in grid
* @param [array] $current_group the id of the current group. Could be if of a
* series, genre, publisher, illustrator, etc.
* @param [string] $selection what selection of books for the grid ('all',
* 'unpublished', 'series', etc.)
* @param [array] $selected_ids ids of the selection
* @param [string] $sort represents sort, ie 'titleA', 'titleD',
* 'series, etc.
* @param [array] $book_ids optional list of book_ids to filter by, useful
* for add-on plugins to add on to grid (ie MA)
*
* @return array of books
*
* @access public
*/
function mbdb_get_books_by_publisher($level, $groups, $current_group, $selection, $selected_ids, $sort, $book_ids ) {
$books = array();
// Get ones w/o publishers first
$current_group[ $groups[ $level ] ] = -1;
// recursively get the next nested group of books
$results = mbdb_get_group( $level + 1, $groups, $current_group, $selection, $selected_ids, $sort, $book_ids );
// only return results if are any so that headers of empty groups
// aren't displayed
if ( count($results) > 0 ) {
$books[ apply_filters('mbdb_book_grid_no_publisher_heading', __('No Publisher Specified', 'mooberry-book-manager')) ] = $results;
}
// loop through each publisher
// and recursively get the next nested group of books for that publisher
$mbdb_options = get_option('mbdb_options');
if (array_key_exists('publishers', $mbdb_options)) {
$publishers = $mbdb_options['publishers'];
foreach($publishers as $publisher) {
$current_group[ $groups [ $level ] ] = $publisher['uniqueID'];
$results = mbdb_get_group( $level + 1, $groups, $current_group, $selection, $selected_ids, $sort, $book_ids );
// only return results if are any so that headers of empty groups
// aren't displayed
if (count($results)>0) {
$books[ apply_filters('mbdb_book_grid_heading', __('Published by ', 'mooberry-book-manager') . $publisher['name'])] = $results;
}
}
}
return $books;
}
/**
* Get books by taxonomy
*
* @since
* @param [int] $level the nested level of the grid we're currently one
* @param [array] $groups the groups in grid
* @param [array] $current_group the id of the current group. Could be id of a
* series, genre, publisher, illustrator, etc.
* @param [string] $selection what selection of books for the grid ('all',
* 'unpublished', 'series', etc.)
* @param [array] $selected_ids ids of the selection
* @param [string] $sort represents sort, ie 'titleA', 'titleD',
* 'series, etc.
* @param [array] $book_ids optional list of book_ids to filter by, useful
* for add-on plugins to add on to grid (ie MA)
*
* @return array of books
*
* @access public
*/
function mbdb_get_books_by_taxonomy($level, $groups, $current_group, $selection, $selected_ids, $sort, $book_ids ) {
$books = array();
// Get ones not in the taxonomy first
$current_group[ $groups[ $level ] ] = -1;
// recursively get the next nested group of books
$results = mbdb_get_group($level + 1, $groups, $current_group, $selection, $selected_ids, $sort, $book_ids );
// only return results if are any so that headers of empty groups
// aren't displayed
if (count($results)>0) {
switch ($groups[$level]) {
case 'genre':
$empty = apply_filters('mbdb_book_grid_uncategorized_heading', __('Uncategorized', 'mooberry-book-manager'));
break;
case 'series':
$empty = apply_filters('mbdb_book_grid_standalones_heading', __('Standalones', 'mooberry-book-manager'));
break;
case 'tag':
$empty = apply_filters('mbdb_book_grid_untagged_heading', __('Untagged', 'mooberry-book-manager'));
break;
case 'editor':
$empty = apply_filters('mbdb_book_grid_uncategorized_heading', __('No Editor Specified', 'mooberry-book-manager'));
break;
case 'illustrator':
$empty = apply_filters('mbdb_book_grid_uncategorized_heading', __('No Illustrator Specified', 'mooberry-book-manager'));
break;
case 'cover_artist':
$empty = apply_filters('mbdb_book_grid_uncategorized_heading', __('No Cover Artist Specified', 'mooberry-book-manager'));
break;
}
$books[ $empty] = $results;
}
// loop through each term
// and recursively get the next nested group of books for that term
$terms_query = array('orderby' => 'slug',
'hide_empty' => true);
// if we're grouping by what we're filtering by, only get terms that we're filtering on
if ($groups[$level] == $selection) {
$terms_query['include'] = $selected_ids;
}
$all_terms = get_terms( 'mbdb_' . $groups[$level], $terms_query);
$taxonomy = get_taxonomy('mbdb_' . $groups[$level]);
// loop through all the terms
foreach ($all_terms as $term) {
$current_group[$groups[$level]] = $term->term_id;
$results = mbdb_get_group($level+1, $groups, $current_group, $selection, $selected_ids, $sort, $book_ids );
// only return results if are any so that headers of empty groups
// aren't displayed
if (count($results)>0) {
if (in_array($groups[$level], array('genre', 'series', 'tag'))) {
$heading = $term->name . ' ' . $taxonomy->labels->singular_name;
} else {
$heading = $taxonomy->labels->singular_name . ' ' . $term->name;
}
$books[ apply_filters('mbdb_book_grid_heading', $heading )] = $results;
}
}
return $books;
}
/**
*
* If any of the groups is a series, order by series
* otherwise order by whatever came in
*
*
* @since 3.0
* @param [array] $groups list of groups for the grid
* @param [string] $sort sort setting
*
* @return sort setting
*
* @access public
*/
function mbdb_set_sort($groups, $sort) {
if (in_array('series', $groups)) {
return 'series_order';
} else {
return $sort;
}
}
/*****************************************************************************
DISPLAY GRID
*******************************************************************************/
/**
* Loop through the $books array and generate the HTML output for the
* grid, including printing out the headings and indenting at each
* nested level
*
* Recursively called for each level
*
* @since 1.0
* @since 2.0 made responsive
* @since 3.0 re-factored
*
* @param [array] $mbdb_books nested array of books in grid
* @param [int] $l current level to display
*
* @return Return_Description
*
* @access public
*/
function mbdb_display_grid($mbdb_books, $l) {
// grab the coming soon image
$mbdb_options = get_option('mbdb_options');
$coming_soon_image = $mbdb_options['coming-soon'];
// indent the grid by 15px per depth level of the array
do_action('mbdb_book_grid_pre_div', $l);
$content = '<div class="mbm-book-grid-div" style="padding-left:' . (15 * $l) . 'px;">';
if (count($mbdb_books)>0) {
// because the index of the array could be a genre or series name and not a sequential index use array_keys to get the index
// if the first element in the array is an object that means there's NOT another level in the array
// so just print out the grid and skip the rest
$the_key = array_keys($mbdb_books);
if (count($the_key)>0) {
// this breaks the recursion
if ( gettype( $mbdb_books[$the_key[0]] ) == 'object') {
foreach ($mbdb_books as $book) {
do_action('mbdb_book_grid_pre_div', $l);
$content .= mbdb_output_grid_book($book, $coming_soon_image);
}
$content .= '</div>';
do_action('mbdb_book_grid_post_div', $l);
return apply_filters('mbdb_book_grid_content', $content, $l);
}
}
// loop through each book
foreach ($mbdb_books as $key => $set) {
// If a label is set and there's at least one book, print the label
if ( $key && count( $set ) > 0 ) {
// set the heading level based on the depth level of the array
do_action('mbdb_book_grid_pre_heading', $l, $key);
// start the headings at H2
$heading_level = $l + 2;
// Headings can only go to H6
if ($heading_level > 6) {
$heading_level = 6;
}
// display the heading
$content .= '<h' . $heading_level . ' class="mbm-book-grid-heading' . ( $l + 1 ) . '">' . esc_html($key) . '</h' . $heading_level .'>';
do_action('mbdb_book_grid_post_heading', $l, $key);
}
if ( gettype( $set ) != 'object') {
do_action('mbdb_book_grid_pre_recursion',$set, $l+1);
$content .= mbdb_display_grid($set, $l+1);
do_action('mbdb_book_grid_post_recursion', $set, $l+1);
}
}
} else {
do_action('mbdb_book_grid_no_books_found');
$content = apply_filters('mbdb_book_grid_books_not_found', $content . __('Books not found', 'mooberry-book-manager'));
}
$content .= '</div>';
do_action('mbdb_book_grid_post_div', $l);
return apply_filters('mbdb_book_grid_content', $content, $l);
}
/**
* Generate the HTML to display a book and its cover image
* coming soon object passed as parameter because it's stored in
* the options and this function is called several times
*
* @since 1.0
* @since 2.0 made responsive
* @since 3.0 re-factored, added alt text
*
* @param [obj] $book book object
* @param [string] $coming_soon_image coming soon image
*
* @return html output
*
* @access public
*/
function mbdb_output_grid_book($book, $coming_soon_image) {
$image = $book->cover;
$default_alt = __('Book Cover:', 'mooberry-book-manager') . ' ' . $book->post_title;
$content = '<span class="mbdb_float_grid">';
if ($image) {
$alt = mbdb_get_alt_text( $book->cover_id, $default_alt );
$content .= '<div class="mbdb_grid_image">';
$content = apply_filters('mbdb_book_grid_pre_image', $content, $book->book_id, $image);
$content .= '<a class="mbm-book-grid-title-link" href="' . esc_url(get_permalink($book->book_id)) . '"><img src="' . esc_url($image) . '" ' . $alt . ' ></a>';
$content = apply_filters('mbdb_book_grid_post_image', $content, $book->book_id, $image);
$content .= '</div>';
} else {
if (isset($coming_soon_image)) {
$alt = mbdb_get_alt_text( 0, $default_alt );
$content .= '<div class="mbdb_grid_image">';
$content = apply_filters('mbdb_book_grid_pre_placeholder_image', $content, $book->book_id, $coming_soon_image);
$content .= '<a class="mbm-book-grid-title-link" href="' . esc_url(get_permalink($book->book_id)) . '"><img src="' . esc_url($coming_soon_image) . '" ' . $alt . ' ></a></div>';
$content = apply_filters('mbdb_book_grid_post_placeholder_image', $content, $book->book_id, $coming_soon_image);
} else {
$content .= '<div class="mbdb_grid_no_image">';
$content = apply_filters('mbdb_book_grid_no_image', $content, $book->book_id);
$content .= '</div>';
}
}
$content .= '<span class="mbdb_grid_title">';
$content = apply_filters('mbdb_book_grid_pre_link', $content, $book->book_id, $book->post_title);
$content .= '<a class="mbm-book-grid-title-link" href="' . esc_url(get_permalink($book->book_id)) . '">' . esc_html($book->post_title) . '</a>';
$content = apply_filters('mbdb_book_grid_post_link', $content, $book->book_id, $book->post_title);
$content .= '</span></span>';
return $content;
}