Advertisement
Guest User

Untitled

a guest
Dec 18th, 2017
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.03 KB | None | 0 0
  1. <?php
  2. /**
  3. * Style template.
  4. *
  5. * @package AMP
  6. */
  7.  
  8. /**
  9. * Context.
  10. *
  11. * @var AMP_Post_Template $this
  12. */
  13.  
  14. $content_max_width = absint( $this->get( 'content_max_width' ) );
  15. $theme_color = $this->get_customizer_setting( 'theme_color' );
  16. $text_color = $this->get_customizer_setting( 'text_color' );
  17. $muted_text_color = $this->get_customizer_setting( 'muted_text_color' );
  18. $border_color = $this->get_customizer_setting( 'border_color' );
  19. $link_color = $this->get_customizer_setting( 'link_color' );
  20. $header_background_color = $this->get_customizer_setting( 'header_background_color' );
  21. $header_color = $this->get_customizer_setting( 'header_color' );
  22. ?>
  23. /* Generic WP styling */
  24.  
  25. .alignright {
  26. float: right;
  27. }
  28.  
  29. .alignleft {
  30. float: left;
  31. }
  32.  
  33. .aligncenter {
  34. display: block;
  35. margin-left: auto;
  36. margin-right: auto;
  37. }
  38.  
  39. .amp-wp-enforced-sizes {
  40. /** Our sizes fallback is 100vw, and we have a padding on the container; the max-width here prevents the element from overflowing. **/
  41. max-width: 100%;
  42. margin: 0 auto;
  43. }
  44.  
  45. .amp-wp-unknown-size img {
  46. /** Worst case scenario when we can't figure out dimensions for an image. **/
  47. /** Force the image into a box of fixed dimensions and use object-fit to scale. **/
  48. object-fit: contain;
  49. }
  50.  
  51. /* Template Styles */
  52.  
  53. .amp-wp-content,
  54. .amp-wp-title-bar div {
  55. <?php if ( $content_max_width > 0 ) : ?>
  56. margin: 0 auto;
  57. max-width: <?php echo sprintf( '%dpx', $content_max_width ); ?>;
  58. <?php endif; ?>
  59. }
  60.  
  61. html {
  62. background: <?php echo sanitize_hex_color( $header_background_color ); ?>;
  63. }
  64.  
  65. body {
  66. background: <?php echo sanitize_hex_color( $theme_color ); ?>;
  67. color: <?php echo sanitize_hex_color( $text_color ); ?>;
  68. font-family: 'Merriweather', 'Times New Roman', Times, Serif;
  69. font-weight: 300;
  70. line-height: 1.75em;
  71. }
  72.  
  73. p,
  74. ol,
  75. ul,
  76. figure {
  77. margin: 0 0 1em;
  78. padding: 0;
  79. }
  80.  
  81. a,
  82. a:visited {
  83. color: <?php echo sanitize_hex_color( $link_color ); ?>;
  84. }
  85.  
  86. a:hover,
  87. a:active,
  88. a:focus {
  89. color: <?php echo sanitize_hex_color( $text_color ); ?>;
  90. }
  91.  
  92. /* Quotes */
  93.  
  94. blockquote {
  95. color: <?php echo sanitize_hex_color( $text_color ); ?>;
  96. background: rgba(127,127,127,.125);
  97. border-left: 2px solid <?php echo sanitize_hex_color( $link_color ); ?>;
  98. margin: 8px 0 24px 0;
  99. padding: 16px;
  100. }
  101.  
  102. blockquote p:last-child {
  103. margin-bottom: 0;
  104. }
  105.  
  106. /* UI Fonts */
  107.  
  108. .amp-wp-meta,
  109. .amp-wp-header div,
  110. .amp-wp-title,
  111. .wp-caption-text,
  112. .amp-wp-tax-category,
  113. .amp-wp-tax-tag,
  114. .amp-wp-comments-link,
  115. .amp-wp-footer p,
  116. .back-to-top {
  117. font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen-Sans", "Ubuntu", "Cantarell", "Helvetica Neue", sans-serif;
  118. }
  119.  
  120. /* Header */
  121.  
  122. .amp-wp-header {
  123. background-color: <?php echo sanitize_hex_color( $header_background_color ); ?>;
  124. }
  125.  
  126. .amp-wp-header div {
  127. color: <?php echo sanitize_hex_color( $header_color ); ?>;
  128. font-size: 1em;
  129. font-weight: 400;
  130. margin: 0 auto;
  131. max-width: calc(840px - 32px);
  132. padding: .875em 16px;
  133. position: relative;
  134. }
  135.  
  136. .amp-wp-header a {
  137. color: <?php echo sanitize_hex_color( $header_color ); ?>;
  138. text-decoration: none;
  139. }
  140.  
  141. /* Site Icon */
  142.  
  143. .amp-wp-header .amp-wp-site-icon {
  144. /** site icon is 32px **/
  145. background-color: <?php echo sanitize_hex_color( $header_color ); ?>;
  146. border: 1px solid <?php echo sanitize_hex_color( $header_color ); ?>;
  147. border-radius: 50%;
  148. position: absolute;
  149. right: 18px;
  150. top: 10px;
  151. }
  152.  
  153. /* Article */
  154.  
  155. .amp-wp-article {
  156. color: <?php echo sanitize_hex_color( $text_color ); ?>;
  157. font-weight: 400;
  158. margin: 1.5em auto;
  159. max-width: 840px;
  160. overflow-wrap: break-word;
  161. word-wrap: break-word;
  162. }
  163.  
  164. /* Article Header */
  165.  
  166. .amp-wp-article-header {
  167. align-items: center;
  168. align-content: stretch;
  169. display: flex;
  170. flex-wrap: wrap;
  171. justify-content: space-between;
  172. margin: 1.5em 16px 0;
  173. }
  174.  
  175. .amp-wp-title {
  176. color: <?php echo sanitize_hex_color( $text_color ); ?>;
  177. display: block;
  178. flex: 1 0 100%;
  179. font-weight: 900;
  180. margin: 0 0 .625em;
  181. width: 100%;
  182. }
  183.  
  184. /* Article Meta */
  185.  
  186. .amp-wp-meta {
  187. color: <?php echo sanitize_hex_color( $muted_text_color ); ?>;
  188. display: inline-block;
  189. flex: 2 1 50%;
  190. font-size: .875em;
  191. line-height: 1.5em;
  192. margin: 0 0 1.5em;
  193. padding: 0;
  194. }
  195.  
  196. .amp-wp-article-header .amp-wp-meta:last-of-type {
  197. text-align: right;
  198. }
  199.  
  200. .amp-wp-article-header .amp-wp-meta:first-of-type {
  201. text-align: left;
  202. }
  203.  
  204. .amp-wp-byline amp-img,
  205. .amp-wp-byline .amp-wp-author {
  206. display: inline-block;
  207. vertical-align: middle;
  208. }
  209.  
  210. .amp-wp-byline amp-img {
  211. border: 1px solid <?php echo sanitize_hex_color( $link_color ); ?>;
  212. border-radius: 50%;
  213. position: relative;
  214. margin-right: 6px;
  215. }
  216.  
  217. .amp-wp-posted-on {
  218. text-align: right;
  219. }
  220.  
  221. /* Featured image */
  222.  
  223. .amp-wp-article-featured-image {
  224. margin: 0 0 1em;
  225. }
  226. .amp-wp-article-featured-image amp-img {
  227. margin: 0 auto;
  228. }
  229. .amp-wp-article-featured-image.wp-caption .wp-caption-text {
  230. margin: 0 18px;
  231. }
  232.  
  233. /* Article Content */
  234.  
  235. .amp-wp-article-content {
  236. margin: 0 16px;
  237. }
  238.  
  239. .amp-wp-article-content ul,
  240. .amp-wp-article-content ol {
  241. margin-left: 1em;
  242. }
  243.  
  244. .amp-wp-article-content amp-img {
  245. margin: 0 auto;
  246. }
  247.  
  248. .amp-wp-article-content amp-img.alignright {
  249. margin: 0 0 1em 16px;
  250. }
  251.  
  252. .amp-wp-article-content amp-img.alignleft {
  253. margin: 0 16px 1em 0;
  254. }
  255.  
  256. /* Captions */
  257.  
  258. .wp-caption {
  259. padding: 0;
  260. }
  261.  
  262. .wp-caption.alignleft {
  263. margin-right: 16px;
  264. }
  265.  
  266. .wp-caption.alignright {
  267. margin-left: 16px;
  268. }
  269.  
  270. .wp-caption .wp-caption-text {
  271. border-bottom: 1px solid <?php echo sanitize_hex_color( $border_color ); ?>;
  272. color: <?php echo sanitize_hex_color( $muted_text_color ); ?>;
  273. font-size: .875em;
  274. line-height: 1.5em;
  275. margin: 0;
  276. padding: .66em 10px .75em;
  277. }
  278.  
  279. /* AMP Media */
  280.  
  281. amp-carousel {
  282. background: <?php echo sanitize_hex_color( $border_color ); ?>;
  283. margin: 0 -16px 1.5em;
  284. }
  285. amp-iframe,
  286. amp-youtube,
  287. amp-instagram,
  288. amp-vine {
  289. background: <?php echo sanitize_hex_color( $border_color ); ?>;
  290. margin: 0 -16px 1.5em;
  291. }
  292.  
  293. .amp-wp-article-content amp-carousel amp-img {
  294. border: none;
  295. }
  296.  
  297. amp-carousel > amp-img > img {
  298. object-fit: contain;
  299. }
  300.  
  301. .amp-wp-iframe-placeholder {
  302. background: <?php echo sanitize_hex_color( $border_color ); ?> url( <?php echo esc_url( $this->get( 'placeholder_image_url' ) ); ?> ) no-repeat center 40%;
  303. background-size: 48px 48px;
  304. min-height: 48px;
  305. }
  306.  
  307. /* Article Footer Meta */
  308.  
  309. .amp-wp-article-footer .amp-wp-meta {
  310. display: block;
  311. }
  312.  
  313. .amp-wp-tax-category,
  314. .amp-wp-tax-tag {
  315. color: <?php echo sanitize_hex_color( $muted_text_color ); ?>;
  316. font-size: .875em;
  317. line-height: 1.5em;
  318. margin: 1.5em 16px;
  319. }
  320.  
  321. .amp-wp-comments-link {
  322. color: <?php echo sanitize_hex_color( $muted_text_color ); ?>;
  323. font-size: .875em;
  324. line-height: 1.5em;
  325. text-align: center;
  326. margin: 2.25em 0 1.5em;
  327. }
  328.  
  329. .amp-wp-comments-link a {
  330. border-style: solid;
  331. border-color: <?php echo sanitize_hex_color( $border_color ); ?>;
  332. border-width: 1px 1px 2px;
  333. border-radius: 4px;
  334. background-color: transparent;
  335. color: <?php echo sanitize_hex_color( $link_color ); ?>;
  336. cursor: pointer;
  337. display: block;
  338. font-size: 14px;
  339. font-weight: 600;
  340. line-height: 18px;
  341. margin: 0 auto;
  342. max-width: 200px;
  343. padding: 11px 16px;
  344. text-decoration: none;
  345. width: 50%;
  346. -webkit-transition: background-color 0.2s ease;
  347. transition: background-color 0.2s ease;
  348. }
  349.  
  350. /* AMP Footer */
  351.  
  352. .amp-wp-footer {
  353. border-top: 1px solid <?php echo sanitize_hex_color( $border_color ); ?>;
  354. margin: calc(1.5em - 1px) 0 0;
  355. }
  356.  
  357. .amp-wp-footer div {
  358. margin: 0 auto;
  359. max-width: calc(840px - 32px);
  360. padding: 1.25em 16px 1.25em;
  361. position: relative;
  362. }
  363.  
  364. .amp-wp-footer h2 {
  365. font-size: 1em;
  366. line-height: 1.375em;
  367. margin: 0 0 .5em;
  368. }
  369.  
  370. .amp-wp-footer p {
  371. color: <?php echo sanitize_hex_color( $muted_text_color ); ?>;
  372. font-size: .8em;
  373. line-height: 1.5em;
  374. margin: 0 85px 0 0;
  375. }
  376.  
  377. .amp-wp-footer a {
  378. text-decoration: none;
  379. }
  380.  
  381. .back-to-top {
  382. bottom: 1.275em;
  383. font-size: .8em;
  384. font-weight: 600;
  385. line-height: 2em;
  386. position: absolute;
  387. right: 16px;
  388. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement