<?php /* * QUOTEBOARD * Get Board * * Displays a single board, called from single-quote.php */ if (has_post_thumbnail()) { $board_thumbnail = wp_get_attachment_image_src(get_post_thumbnail_id(), 'thumb-small'); $board_thumbnail = '<img src="' . $board_thumbnail[0] . '">'; } else { $board_thumbnail = get_default_thumbnail('thumb-small'); } echo ' <li> <a href="' . get_permalink() . '">' . $board_thumbnail . get_the_title() . ' </a> </li>';
$character = get_field('quote_character'); // fetch quote contributor; set to "You" for quotes added by current user $contributor = get_the_author_meta('display_name'); if ($contributor == $current_user->display_name) { $contributor = 'You'; $quote_class = ' yours'; $home_url = ''; } else { $quote_class = ''; $home_url = 'author/' . get_the_author_meta('user_nicename'); } // fetch quote board $board_id = get_post_meta($post->ID, 'quote_board', true); // get avatar (relies on WP User Avatar plugin) if (!($author_avatar = get_wp_user_avatar($author['ID'], 60))) { $author_avatar = get_default_thumbnail('thumb-small'); } // use character image whenever possible if ($character) { if ($character_image_id = get_field('character_image', $character->ID)) { $author_avatar = wp_get_attachment_image($character_image_id, 'thumb-small'); } } ?> <article class="quote box<?php echo $quote_class; ?> " data-author="<?php echo $author['ID']; ?>
<?php /* * QUOTEBOARD * Single Character * * Called from loop-characters.php and search.php. * Displays a single character in list view. */ $character_id = get_the_ID(); // fetch stats // $quotecount = $wpdb->get_var ( "SELECT COUNT(*) FROM $wpdb->postmeta WHERE meta_key = 'quote_board' AND meta_value LIKE '%" . $post->ID . "%'" ); // thumbnail if (has_post_thumbnail()) { $character_thumbnail = wp_get_attachment_image_src(get_post_thumbnail_id(), 'thumbnail'); $character_thumbnail = '<img src="' . $character_thumbnail[0] . '" alt="' . get_the_title() . '">'; } else { $character_thumbnail = get_default_thumbnail('thumbnail'); } if (!($character_description = get_the_content())) { $character_description = '<em>Alas, this character has no description.</em>'; } echo '<article class="board box"> <a class="avatar" href="' . get_permalink() . '">' . $character_thumbnail . '</a> <div> <div class="bubble" data-link="' . get_permalink() . '"> <h4>' . get_the_title() . '</h4> <p>' . $character_description . '</p> </div> </div> </article>';
<?php /* * QUOTEBOARD * Single Source * * Called from loop-sources.php and search.php. * Displays a single source in list view. */ $source_id = get_the_ID(); // fetch stats // $quotecount = $wpdb->get_var ( "SELECT COUNT(*) FROM $wpdb->postmeta WHERE meta_key = 'quote_board' AND meta_value LIKE '%" . $post->ID . "%'" ); // thumbnail if (has_post_thumbnail()) { $source_thumbnail = wp_get_attachment_image_src(get_post_thumbnail_id(), 'thumbnail'); $source_thumbnail = '<img src="' . $source_thumbnail[0] . '" alt="' . get_the_title() . '">'; } else { $source_thumbnail = get_default_thumbnail('thumbnail'); } if (!($source_description = get_the_content())) { $source_description = '<em>Alas, this source has no description.</em>'; } echo '<article class="board box"> <a class="avatar" href="' . get_permalink() . '">' . $source_thumbnail . '</a> <div> <div class="bubble" data-link="' . get_permalink() . '"> <h4>' . get_the_title() . '</h4> <p>' . $source_description . '</p> </div> </div> </article>';