Ballyhoo

Simple and customizable.

Functions

27th December 2018

Please note: This page is about the functions that are unique to Ballyhoo, not every single function that is found in Ballyhoo’s function.php file.

ballyhoo_index_post();

ballyhoo_index_post($post_type);

This function is used in the index.php file to output the right code for each post type to display each post. For example, ballyhoo_index_post(‘status’); gets the code to display a status post.

If there is nothing between the two quotes, then the code for the default post type will be outputted.

Code

function ballyhoo_index_post($post_type) { 
if ($post_type === 'aside') : ?>
<div id="post-<?php the_ID(); ?>"
<?php post_class(); ?>>
<h1 class="post-title"><?php the_title(); ?></h1>
<?php the_post_thumbnail( 'single-post-thumbnail' ); ?>
<?php the_content(); ?>
</div>
<?php elseif ($post_type === 'chat') : ?>
<div id="post-<?php the_ID(); ?>"
<?php post_class(); ?>>
<h1 class="post-title"><?php the_title(); ?></h1>
<?php the_post_thumbnail( 'single-post-thumbnail' ); ?>
<?php the_content(); ?>
</div>
<?php elseif ($post_type === 'gallery') : ?>
<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<a href="<?php the_permalink(); ?>" class="post-link-title"><h1 class="post-title"><?php the_title(); ?></h1></a>
<?php the_post_thumbnail( 'single-post-thumbnail' ); ?>
<?php the_content(); ?>
</div>
<?php elseif ($post_type === 'quote') : ?>
<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<a href="<?php the_permalink(); ?>" class="post-link-title"><h1 class="post-title"><?php the_title(); ?></h1></a>
<?php the_post_thumbnail( 'single-post-thumbnail' ); ?>
<?php the_content(); ?>
</div>
<?php elseif ($post_type === 'link') : ?>
<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<a href="<?php the_permalink(); ?>" class="post-link-title"><h1 class="post-title"><?php the_title(); ?></h1></a>
<?php the_post_thumbnail('single-post-thumbnail'); ?>
<?php the_content(); ?>
</div>
<?php elseif ($post_type === 'status') : ?>
<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<a href="<?php the_permalink(); ?>" class="post-link-title"><h1 class="post-title"><?php the_title(); ?></h1></a>
<p class="post-published-date"><i class="far fa-clock" aria-label="Date and time published:" title="Date and time published:"></i> <?php echo get_the_date(); ?> <?php echo get_the_time(); ?></p>
<?php the_content(); ?>
</div>
<?php elseif ($post_type === 'normal') : ?>
<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<a href="<?php the_permalink(); ?>" class="post-link-title"><h1 class="post-title"><?php the_title(); ?></h1></a> <?php the_post_thumbnail( 'single-post-thumbnail' ); ?> <p class="post-published-date"><i class="far fa-clock" aria-label="Date published:" title="Date published:"></i> <?php echo get_the_date(); ?></p>
<p class="post-comment-number"><i class="far fa-comment" aria-label="Number of comments:" title="Number of comments"></i> <?php comments_popup_link('No Comments', '1 Comment', '% Comments', 'ballyhoo'); ?></p>
<p class="post-author"><i class="far fa-user"></i> <?php the_author(); ?></p> <?php the_excerpt(); ?> <a class="button" href="<?php the_permalink(); ?>">Tell me more...</a> </div>
<?php endif; ?>