feat: add excerpt and author removal functionality
Enhanced article previews with excerpts and cleaned up date rendering. Implemented option to remove authors in meta box for better user control. Improves overall usability and experience.
This commit is contained in:
parent
5ab9e5a62a
commit
625a2f0639
4 changed files with 15 additions and 9 deletions
|
@ -23,8 +23,9 @@
|
|||
} else {
|
||||
the_author();
|
||||
}
|
||||
?> | <?php the_date(); ?>
|
||||
?>
|
||||
</p>
|
||||
<p class="card-text"><?php the_excerpt(); ?></p>
|
||||
<a href="<?php the_permalink(); ?>" class="btn btn-outline-primary">Read More</a>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -237,9 +237,12 @@ function render_article_authors_meta_box($post)
|
|||
<div id="article-authors-list">
|
||||
<?php
|
||||
if (!empty($authors)) {
|
||||
foreach ($authors as $author) {
|
||||
foreach ($authors as $index => $author) {
|
||||
?>
|
||||
<p><input type="text" name="article_authors[]" value="<?php echo esc_attr($author); ?>" /></p>
|
||||
<p>
|
||||
<input type="text" name="article_authors[]" value="<?php echo esc_attr($author); ?>" />
|
||||
<button type="button" class="button remove-author-button" data-index="<?php echo $index; ?>"><?php _e('Remove', 'duck-behavior-journal'); ?></button>
|
||||
</p>
|
||||
<?php
|
||||
}
|
||||
} else {
|
||||
|
@ -254,7 +257,11 @@ function render_article_authors_meta_box($post)
|
|||
<script>
|
||||
jQuery(document).ready(function($) {
|
||||
$('#add-author-button').on('click', function() {
|
||||
$('#article-authors-list').append('<p><input type="text" name="article_authors[]" value="" /></p>');
|
||||
$('#article-authors-list').append('<p><input type="text" name="article_authors[]" value="" /><button type="button" class="button remove-author-button"><?php _e('Remove', 'duck-behavior-journal'); ?></button></p>');
|
||||
});
|
||||
|
||||
$(document).on('click', '.remove-author-button', function() {
|
||||
$(this).parent().remove();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
|
|
@ -37,8 +37,9 @@
|
|||
} else {
|
||||
the_author();
|
||||
}
|
||||
?> | <?php the_date(); ?>
|
||||
?>
|
||||
</p>
|
||||
<p class="card-text"><?php the_excerpt(); ?></p>
|
||||
<a href="<?php the_permalink(); ?>" class="btn btn-outline-primary">Read More</a>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -14,11 +14,8 @@
|
|||
} else {
|
||||
the_author();
|
||||
}
|
||||
?> | <?php the_date(); ?>
|
||||
?>
|
||||
</p>
|
||||
<?php if (has_post_thumbnail()) : ?>
|
||||
<img src="<?php the_post_thumbnail_url(); ?>" class="img-fluid mb-4" alt="<?php the_title(); ?>">
|
||||
<?php endif; ?>
|
||||
<?php the_content(); ?>
|
||||
<?php endwhile;
|
||||
endif; ?>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue