Twentig
Forum Replies Created
-
Twentig shouldn’t present any problem, the difficulties might come from the Twenty Twenty theme styles (full-width blocks, left-aligned and right-aligned elements …).
To set the blog featured images to be full width, the following PHP code should be added inside the child theme’s functions.php file:
function set_post_image_full() { if ( ! is_singular() ) { add_filter( 'post_thumbnail_size', function() { return 'full'; } ); } } add_action( 'get_template_part_template-parts/featured-image', 'set_post_image_full' );And the CSS code below should be added inside the style.css file of the child theme or inside the Customizer’s Additional CSS panel:
.blog .featured-media-inner, .archive .featured-media-inner { max-width: none; width: 100%; } .blog .featured-media-inner img, .archive .featured-media-inner img { width: 100%; }Hi,
Thank you for bringing this to our attention. The Twenty Twenty’s page templates (Cover Template and Full Width Template) display the comments. In the Twentig templates, we have chosen not to display them. However, you can easily add them by adding the following PHP code inside the functions.php file of your child theme:
function enable_page_comments() { if ( ( comments_open() || get_comments_number() ) && ! post_password_required() ) { ?> <div class="comments-wrapper section-inner"> <?php comments_template(); ?> </div><!-- .comments-wrapper --> <?php } } add_action( 'twentig_article_end', 'enable_page_comments' );You can locate the Twentig templates inside your plugins folder under twentig/inc/twentytwenty/templates
I hope the above is useful to you,
Have a nice day.Hi,
We’ve checked your website, it seems you managed to achieve the layout. This is the right way to make this layout.
Have a nice day.
Hi,
We understand that this feature could be useful. However, Twentig can’t add a blog sidebar due to the way Twenty Twenty theme is coded. We think it’s possible to do it using a child theme, but it would require advanced custom PHP, HTML and CSS modifications, which is outside the scope of what we’re able to support.
Have a nice day.
Hi @leobeaufils,
The CSS code that we gave you works when entered inside the Customizer. If you add it inside a child theme, you must use the following code (to avoid using !important):
.wp-block-latest-posts .wp-block-latest-posts__featured-image.alignleft { max-width: 35%; } .wp-block-latest-posts .wp-block-latest-posts__featured-image.alignleft ~ * { width: calc(65% - 2rem); }You can remove your jQuery code and add PHP code inside your child theme instead.
The code below removes the Twentig filter function and adds a custom one. Replace$sizes = '(max-width: 300px) 100vw, 300px';)with your own value.remove_filter( 'render_block', 'twentig_twentytwenty_change_latest_posts_image_sizes' ); function your_custom_change_latest_posts_image_sizes( $block_content, $block ) { if ( 'core/latest-posts' === $block['blockName'] ) { $image = $block['attrs'] && isset( $block['attrs']['displayFeaturedImage'] ) ? $block['attrs']['displayFeaturedImage'] : 0; if ( $image ) { $sizes = '(max-width: 300px) 100vw, 300px'; return preg_replace( '/sizes="([^>]+?)"/', 'sizes="' . $sizes . '"', $block_content ); } } return $block_content; } add_filter( 'render_block', 'your_custom_change_latest_posts_image_sizes', 10, 2 );I hope the above is useful to you.
If you enjoy Twentig, please leave us a review 🙂Hi Léo,
Twentig changes the size for the left-aligned image inside the Latest Posts block because by default, the layout isn’t responsive. If you look at your website for screen width between 665px and 882px, the post titles aren’t readable, and the images take too much space. The Twenty Twenty theme sets the size to 290px while Twentig changes it to 25%.
If you want to use the Twentig plugin but increase the image size, you can add some custom CSS inside your child theme (or inside the Additional CSS panel in the Customizer) and replace the values below with your own values:
.wp-block-latest-posts__featured-image.alignleft { max-width: 35%; } .wp-block-latest-posts__featured-image.alignleft ~ * { width: calc(65% - 2rem); float: right; }I hope the above is useful to you.
Have a nice day.Hi David,
Thank you for the message and feedback.
When we selected which blog layouts to include, we thought about having this one but decided not to. We felt that this layout for a blog index isn’t ideal, especially on large screens. We don’t think that having a different layout for the index and the single post is necessarily inconsistent, but we understand why you want the same layout.
We don’t see this feature being included in our roadmap, since we aren’t totally convinced with this layout and want to keep the plugin the lightest possible.
That being said, we can give you some custom CSS and PHP code to achieve this layout, but it would require that you add PHP code on your side (child theme, custom plugin …)
Please let us know.
According to the PageSpeed Insights, the duplicate and unused Javascript files on your website all concern the AMP plugin and not Twentig.
As for the Google Fonts, if you look at the Google website, you can also see that their custom fonts are listed under render-blocking resources. This is inherent to the usage of Google Fonts.
Have a nice day.
Hi @kudorollin,
Thanks for your feedback and kind words.
For the fixed cover image, both the Twenty Twenty theme and the WordPress block editor use
background-attachment: fixed. This property is replaced on mobile bybackground-attachment: scroll. Otherwise, the image would appear zoomed in and blurry because mobile browsers have issues with this property.Unfortunately, the CSS code suggested can’t work with the WordPress Cover block.
Have a nice day.
Hi @souldesigns,
Thanks for your feedback. We’ll see if it’s possible to optimize the Google Font loading, but we’ve already using Google recommended method.
If the page speed is your main concern, you can choose the “UI System Font” for both body and headings font (as you are already using sans serif fonts, it won’t drastically change your design). It will boost performance because the browser doesn’t have to download any font files, it’s using one it already had.
I hope the above is useful to you.
Have a nice day.Hi,
Thanks for your message.
The patterns shown in the screenshot are examples of what’s possible to do with the Twentig Library. Some can be inserted right out of the box, some have been mixed and matched. If you need to reproduce a particular one that you don’t find, please let us know.
Have a nice day.
Great! If you enjoy Twentig, please leave us a review 😀
Assuming that you’ve created your own plugin or child theme (to create your CPT), you can add the following PHP code in one of your PHP files. That way, you won’t lose the modifications when you update Twentig.
function my_custom_body_class( $classes ) { if ( is_search() || is_archive() ) { $classes[] = 'tw-blog-grid'; $classes[] = 'tw-blog-' . get_theme_mod( 'twentig_blog_layout' ); $classes[] = 'tw-blog-columns-' . get_theme_mod( 'twentig_blog_columns', '3' ); } return $classes; } add_filter( 'body_class', 'my_custom_body_class', 12 );I hope the above is useful to you,
Have a nice day.You’re using a lightbox plugin that changes the markup of the image block. Your CSS only changes the max-width of the image parent, you should also set a width of 100% for the image.
.single-post .entry-content img { width: 100%; }Have a nice day.