Skip to content

Commit

Permalink
Handle edge cases: lenghty titles, missing thumbnails
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelguebo committed Jan 4, 2024
1 parent f2c8bc1 commit fe9bdb8
Show file tree
Hide file tree
Showing 17 changed files with 83 additions and 103 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).


## [1.2.1] - 2024-01-04
- Handle edge cases: missing thumbnails and lenghty titles

## [1.2.0] - 2024-01-04

- Replace Typed animation with slider on homepage
Expand Down
11 changes: 11 additions & 0 deletions css/style-blue.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion css/style-blue.css.map

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions css/style-dark.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion css/style-dark.css.map

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions css/style-green.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion css/style-green.css.map

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions css/style-red.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion css/style-red.css.map

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions css/style-yellow.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion css/style-yellow.css.map

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions css/style.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion css/style.css.map

Large diffs are not rendered by default.

95 changes: 0 additions & 95 deletions inc/extras.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,13 +153,6 @@ function display_element( $element, &$children_elements, $max_depth, $depth, $ar
call_user_func_array(array(&$this, 'end_el'), $cb_args);
}
}
if(!function_exists('acajou_has_sticky_posts')) {
function acajou_has_sticky_posts(): bool
{
$args = [ 'meta_query' => [ [ 'key' => 'featured', 'value' => 1 ] ] ];
return(new WP_Query( $args ))->have_posts();
}
}

/**
* This functions prints a breadcrumb
Expand Down Expand Up @@ -302,96 +295,8 @@ function acajou_from_blog_title(){
}
echo $text;
}
/*
* Override the default post_thumbnail() content
*
*/
function acajou_get_attachment_id_from_src( $image_src ) {
global $wpdb;
$query = "SELECT ID FROM {$wpdb->posts} WHERE guid='$image_src'";
$id = $wpdb->get_var($query);
return $id;
}
function acajou_get_first_image($post_id) {
$post = get_post($post_id);
$post_content = $post->post_content;
preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post_content, $matches);
return $matches[1][0];
}

function acajou_modify_post_thumbnail_html($html, $post_id, $post_thumbnail_id, $size, $attr) {
if( '' == $html ) {
$attr['class'] = 'default';
global $post, $posts;
ob_start();
ob_end_clean();

acajou_get_first_image($post_id);
$first_img = acajou_get_first_image($post_id);
if ( !empty( $first_img ) ){
$html = '<img src="' . $first_img . '" alt="' . get_the_title($post_id). '" class="' . $attr['class'] . '" />';
}

}
return $html;
}
add_filter('post_thumbnail_html', 'acajou_modify_post_thumbnail_html', 10, 5);

/*
* Customize the comments with this fallback
*
*/
function acajou_custom_comments( $comment, $args, $depth ) {
$GLOBALS['comment'] = $comment;
echo '<div class="comment-list">';
switch( $comment->comment_type ) :
case 'pingback' :
case 'trackback' : ?>
<li <?php comment_class(); ?> id="comment<?php comment_ID(); ?>">
<div class="back-link"><?php comment_author_link(); ?></div>
<?php break;
default : ?>
<li <?php comment_class(); ?> id="comment-<?php comment_ID(); ?>">
<article <?php comment_class(); ?> class="comment">

<div class="comment-body">
<div class="author vcard">
<?php echo get_avatar( $comment, 100 ); ?>
<h6 class="author-name">
<a href="<?php comment_author_link(); ?>"><?php comment_author(); ?></a>
</h6>
<?php comment_text(); ?>
<hr/>
<footer class="comment-footer">
<span class="date">
<?php comment_date('d/m/Y'); ?>
</span> -
<span class="time">
<?php comment_time('H:i'); ?>
</span>
<div class="reply"><?php
comment_reply_link( array_merge( $args, array(
'reply_text' => __( 'Reply', 'acajou' ),
'depth' => $depth,
'max_depth' => $args['max_depth']
) ) ); ?>
</div><!-- .reply -->
</footer><!-- .comment-footer -->
</div><!-- .vcard -->
</div><!-- comment-body -->

</article><!-- #comment-<?php comment_ID(); ?> -->
<?php // End the default styling of comment
break;
endswitch;
echo '</div>';
}

/*
* Creating the social nav menu
* inspired by @http://justintadlock.com/archives/2013/08/14/social-nav-menus-part-2
*
*/
add_action( 'init', 'acajou_register_nav_menus' );

function acajou_register_nav_menus() {
Expand Down
3 changes: 3 additions & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ Icons are automatically detected based on the URL of your social page.
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).

= [1.2.1] - 2024-01-04 =
* Handle edge cases: missing thumbnails and lenghty titles

= [1.2.0] - 2024-01-04 =
* Replace Typed animation with slider on homepage
* Improve Hamburger menu
Expand Down
4 changes: 3 additions & 1 deletion scss/_base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,9 @@ h3,
h4,
h5,
h6 {

text-overflow: ellipsis;
max-width: 100%;
overflow: hidden;
}
.panel h1,
.panel h2,
Expand Down
2 changes: 1 addition & 1 deletion style.css
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Description: Acajou is a clean, simple, and fully responsive WordPress theme tha
Theme is built using <a href="https://github.com/zurb/foundation-sites">Zurb Foundation</a>, a framework for HTML5 / CSS3 which is SEO friendly. This WordPress theme was built with blogs and creative portfolios in mind but be creative and unleash its full potential in eCommerce, business and other projects. Acajou is available in English, French, and Spanish for now.
Tested up to: 6.4
Requires PHP: 7.4
Version: 1.2.0
Version: 1.2.1
License: GNU General Public License v2 or later
License URI: LICENSE
Expand Down

0 comments on commit fe9bdb8

Please sign in to comment.