astra_single_post_css( string $dynamic_css )

Single Post UI Improvement – Dynamic CSS


Description


Parameters

$dynamic_css

(string) (Required) Astra Dynamic CSS.


Return

(String) Generated dynamic CSS for Pagination.


Source

File: inc/dynamic-css/single-post.php

function astra_single_post_css( $dynamic_css ) {
	$is_boxed       = astra_is_content_style_boxed();
	$content_layout = astra_get_content_layout();

	$post_with_unboxed_layout = ( 'plain-container' === $content_layout || 'narrow-container' === $content_layout ) && ! $is_boxed ? true : false;

	$static_css = '
		:root {
			--ast-post-nav-space: 0;
			--ast-single-post-border: #e1e8ed;
		}
		.entry-content h1, .entry-content h2, .entry-content h3, .entry-content h4, .entry-content h5, .entry-content h6 {
			margin-top: 1.5em;
			margin-bottom: calc(0.3em + 10px);
		}
		code, kbd, samp {
			background: var(--ast-code-block-background);
			padding: 3px 6px;
		}
		.ast-row.comment-textarea fieldset.comment-form-comment {
			border: none;
			padding: unset;
			margin-bottom: 1.5em;
		}
		.entry-content > * {
			margin-bottom: 1.5em;
		}
		.entry-content .wp-block-image,
		.entry-content .wp-block-embed {
			margin-top: 2em;
			margin-bottom: 3em;
		}
	';

	if ( $post_with_unboxed_layout ) {
		$static_css .= '
			:root {
				--ast-single-post-nav-padding: 4em 0 0;
			}
			.ast-single-post .ast-post-format-content {
				max-width: 100%;
			}
			.post-navigation + .comments-area {
				border-top: none;
				padding-top: 5em;
			}
		';
	} else {
		$nav_padding = astra_check_current_post_comment_enabled() || 0 < get_comments_number() ? '3em 0 1em' : '3em 0 0';
		$static_css .= '
			:root {
				--ast-single-post-nav-padding: ' . $nav_padding . ';
			}
		';
	}

	$dynamic_css .= Astra_Enqueue_Scripts::trim_css( $static_css );

	return $dynamic_css;
}

Changelog

Changelog
Version Description
4.6.0 Introduced.


User Contributed Notes

You must log in before being able to contribute a note or feedback.