Skip to content

Commit 6982026

Browse files
correct for wp img alignment classes on blog-post and default-page contexts
1 parent 1d0bd4a commit 6982026

File tree

2 files changed

+137
-2
lines changed

2 files changed

+137
-2
lines changed

src/singular.php

+4
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@
5252

5353
</header>
5454

55+
<div class="content"
56+
5557
<?php if (!class_exists('ACF')): ?>
5658

5759
<!-- display raw post_meta, if ACF not installed & activated -->
@@ -117,6 +119,8 @@
117119
));
118120
?>
119121

122+
</div>
123+
120124
<?php if ( $query->have_posts() ) : ?>
121125

122126
<article class="posts related">

src/style.css

+133-2
Original file line numberDiff line numberDiff line change
@@ -608,9 +608,140 @@ main nav.pagination ul li span.current {
608608

609609
/* patches */
610610

611-
main > article figure img, main > figure img {
611+
/* main > article figure img, main > figure img {
612612
width: 100%;
613-
}
613+
} */
614+
614615
main .content ul, main .content ol {
615616
line-height: 150%;
616617
}
618+
619+
/* Classic Editor TinyMCE WYSIWYG editor image alignment */
620+
/* TODO: port in alignleft and alignright rules here as well? */
621+
main figure:has(img.aligncenter) {
622+
width: 100%;
623+
margin-left: 0;
624+
}
625+
626+
/* Classic Editor TinyMCE WYSIWYG editor image alignment, previous theme's markukp */
627+
/* presently <figure> */
628+
div[id^="attachment_"] {
629+
width: 120%;
630+
margin: 0;
631+
margin-left: -10%;
632+
margin-bottom: 3em;
633+
padding: 0;
634+
float: none;
635+
}
636+
637+
/* presently <img> */
638+
div[id^="attachment_"] img[class^="wp-image"]:not([width]) {
639+
width: 100%;
640+
}
641+
642+
/* presently <span class="attribution> */
643+
div[id^="attachment_"] p[id^="caption-attachment-"] {
644+
display: block;
645+
margin-top: 1em;
646+
font-size: 1em;
647+
}
648+
649+
div[id^="attachment_"].alignleft {
650+
margin-top: 2em;
651+
margin-right: 2em;
652+
margin-left: -10%;
653+
width: 50%;
654+
float: left;
655+
}
656+
657+
div[id^="attachment_"].alignleft:after {
658+
display: block;
659+
content: '';
660+
height: 3em;
661+
clear: both;
662+
}
663+
664+
div[id^="attachment_"].aligncenter {
665+
width: 100%;
666+
667+
margin-left: 0;
668+
}
669+
670+
div[id^="attachment_"].alignright {
671+
margin-top: 2em;
672+
margin-right: -10%;
673+
margin-left: 2em;
674+
width: 50%;
675+
float: right;
676+
}
677+
678+
div[id^="attachment_"].alignright:after {
679+
display: block;
680+
content: '';
681+
height: 2em;
682+
clear: both;
683+
}
684+
685+
main .content div[id^="attachment_"].alignleft {
686+
margin-left: 0;
687+
width: 40%;
688+
}
689+
690+
main .content div[id^="attachment_"].alignright {
691+
margin-right: 0;
692+
width: 40%;
693+
}
694+
695+
main .content figure:has(img.alignleft), .blog-post main figure:has(img.alignleft) {
696+
margin-right: 2em;
697+
margin-left: 0;
698+
width: 40%;
699+
float: left;
700+
}
701+
702+
main .content figure:has(img.alignright), .blog-post main figure:has(img.alignright) {
703+
margin-right: 0;
704+
margin-left: 2em;
705+
width: 40%;
706+
float: right;
707+
}
708+
709+
@media (max-width:400px) {
710+
711+
div[id^="attachment_"].alignleft {
712+
width: 100%;
713+
float: none;
714+
margin: 0;
715+
}
716+
717+
div[id^="attachment_"].alignright {
718+
width: 100%;
719+
float: none;
720+
margin: 0;
721+
}
722+
723+
main .content div[id^="attachment_"].alignleft {
724+
width: 100%;
725+
float: none;
726+
margin: 0;
727+
}
728+
729+
main .content div[id^="attachment_"].alignright {
730+
width: 100%;
731+
float: none;
732+
margin: 0;
733+
}
734+
735+
main .content figure:has(img.alignleft), .blog-post main figure:has(img.alignleft) {
736+
width: 100%;
737+
float: none;
738+
margin: 0;
739+
}
740+
741+
main .content figure:has(img.alignright), .blog-post main figure:has(img.alignright) {
742+
width: 100%;
743+
float: none;
744+
margin: 0;
745+
}
746+
747+
}

0 commit comments

Comments
 (0)