Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@jekkilekki
Last active June 11, 2022 22:17
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jekkilekki/bdf62810907ea9f8c319ab902806a38a to your computer and use it in GitHub Desktop.
Save jekkilekki/bdf62810907ea9f8c319ab902806a38a to your computer and use it in GitHub Desktop.
New Website (WordPress) Helpers

New Website (WordPress) Helpers

These website building helpers are originally extracted from the WordPress TwentyTwenty Theme and are intended to provide easy access to some of the most common basic styles for a website.

This Gist will be occasionally updated with my own preferences for these styles. Files include the following:

File Purpose
PHP
Featured Image to REST API How to add Featured Image URLs to the REST API
Programmatically Insert Post Insert a post into the DB using code (Custom Post Type & Taxonomies)
HTML
Base HTML setup Very basic <!doctype html> setup with lots of <head> help
HTML Tags & Formatting A list of the most common website elements to style (typography)
Social Nav Basic HTML for a social navigation menu
CSS
Contents & Header WordPress style Header comment, Table of Contents, and Section divider
Screen Reader Text Special styles for better screen reader accessibility
items may need to be read by screen readers, but not visible to human eyes
Skip Link For screen readers, to use on the Skip to Content link preceding the page
Variable Fonts Usage Example An example of how to use @font-face and variable fonts - including fallbacks
CSS Reset An updated CSS Reset from TwentyTwenty - another (original) can be found here
Document Setup Basic styles that I like to add to the whole document
Element Base Sample rules for all the basic tags included in the HTML Tags & Formatting file
Lists Includes Definition Lists and nested ol and ul lists
Media Includes figure and img tags including captions and other similar tags (also .gallery classes)
Forms & Inputs Mostly includes input tags of all varieties
Tables Basic styles for tables
Cover Modals Basic modal styles
Social Icons Basic social icon styles
Search Form Basic styles to handle a search form and input
Helpers: Opacity & Blend Modes Helper classes like .opacity-10 and .blend-mode-saturation
Helpers: WordPress More Helper classes that may be more useful for WordPress sites
Toggles & Button Resets Resets for .toggle and buttons with that class
<!DOCTYPE html>
<html>
<head>
<!-- Load Web Assets -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/5.16.0/d3.min.js"></script>
<link href="https://fonts.googleapis.com/css2?family=Carter+One&family=Lexend+Deca&display=swap" rel="stylesheet">
<!-- Load Local Assets -->
<link rel="stylesheet" href="./assets/styles/style.css" />
<!-- Favicon -->
<link rel="shortcut icon" type="image/png" href="/img/favicon.png" />
<!-- Site Title and Meta -->
<title>Site Title</title>
<meta name="viewport" content="width=device-width" />
<meta property="og:image" content="https://FULL-URL/social-share.png" />
<meta property="og:title" content="Site Title" />
<meta property="og:type" content="website" />
<meta property="og:url" content="https://aaron.kr/this-site" />
<meta property="og:site_name" content="Site Title" />
<meta property="og:description" content="Descriptive sentence about this site." />
</head>
<body>
<!-- Site Header -->
<header class="site-header">
</header>
<!-- Site Navigation -->
<nav class="site-nav">
</nav>
<!-- Site Content -->
<main class="site-main site-content content">
</main>
<!-- Site Footer -->
<footer class="site-footer">
</footer>
<!-- Footer Scripts -->
<script type="text/javascript" charset="utf-8">
</script>
</body>
</html>
/*
Theme Name: Twenty Twenty
Text Domain: twentytwenty
Version: 1.2
Requires at least: 4.7
Requires PHP: 5.2.4
Description: Our default theme for 2020 is designed to take full advantage of the flexibility of the block editor. Organizations and businesses have the ability to create dynamic landing pages with endless layouts using the group and column blocks. The centered content column and fine-tuned typography also makes it perfect for traditional blogs. Complete editor styles give you a good idea of what your content will look like, even before you publish. You can give your site a personal touch by changing the background colors and the accent color in the Customizer. The colors of all elements on your site are automatically calculated based on the colors you pick, ensuring a high, accessible color contrast for your visitors.
Tags: blog, one-column, custom-background, custom-colors, custom-logo, custom-menu, editor-style, featured-images, footer-widgets, full-width-template, rtl-language-support, sticky-post, theme-options, threaded-comments, translation-ready, block-styles, wide-blocks, accessibility-ready
Author: the WordPress team
Author URI: https://wordpress.org/
Theme URI: https://wordpress.org/themes/twentytwenty/
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
All files, unless otherwise stated, are released under the GNU General Public
License version 2.0 (http://www.gnu.org/licenses/gpl-2.0.html)
This theme, like WordPress, is licensed under the GPL.
Use it to make something cool, have fun, and share what you've learned
with others.
*/
/*--------------------------------------------------------------
>>> TABLE OF CONTENTS:
----------------------------------------------------------------
0. CSS Reset
1. Document Setup
2. Element Base
3. Helper Classes
4. Site Header
5. Menu Modal
6. Search Modal
7. Page Templates
a. Template: Cover Template
c. Template: Full Width
8. Post: Archive
9. Post: Single
10. Blocks
11. Entry Content
12. Comments
13. Site Pagination
14. Error 404
15. Widgets
16. Site Footer
17. Media Queries
----------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
/* 0. CSS Reset
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
/* 0. CSS Reset
/* -------------------------------------------------------------------------- */
html,
body {
border: none;
margin: 0;
padding: 0;
}
h1,
h2,
h3,
h4,
h5,
h6,
p,
blockquote,
address,
big,
cite,
code,
em,
font,
img,
small,
strike,
sub,
sup,
li,
ol,
ul,
fieldset,
form,
label,
legend,
button,
table,
caption,
tr,
th,
td {
border: none;
font-size: inherit;
line-height: inherit;
margin: 0;
padding: 0;
text-align: inherit;
}
blockquote::before,
blockquote::after {
content: "";
}
/* -------------------------------------------------------------------------- */
/* 1. Document Setup
/* -------------------------------------------------------------------------- */
html {
font-size: 62.5%; /* 1rem = 10px */
scroll-behavior: smooth;
}
@media (prefers-reduced-motion: reduce) {
html {
scroll-behavior: auto;
}
}
body {
background: #f5efe0;
box-sizing: border-box;
color: #000;
font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, sans-serif;
font-size: 1.8rem;
letter-spacing: -0.015em;
text-align: left;
}
*,
*::before,
*::after {
box-sizing: inherit;
-webkit-font-smoothing: antialiased;
word-break: break-word;
word-wrap: break-word;
}
#site-content {
overflow: hidden;
}
/* Clearing ---------------------------------- */
.group::after,
.entry-content::after {
clear: both;
content: "";
display: block;
}
/* Base Transitions -------------------------- */
a,
path {
transition: all 0.15s linear;
}
/* Accessibility Settings -------------------- */
@media ( prefers-reduced-motion: reduce ) {
* {
animation-duration: 0s !important;
transition-duration: 0s !important;
}
}
/* -------------------------------------------------------------------------- */
/* 2. Element Base
/* ---------------------------------------------*---------------------------- */
main {
display: block;
}
h1,
h2,
h3,
h4,
h5,
h6,
.faux-heading {
font-feature-settings: "lnum";
font-variant-numeric: lining-nums;
font-weight: 700;
letter-spacing: -0.0415625em;
line-height: 1.25;
margin: 3.5rem 0 2rem;
}
h1,
.heading-size-1 {
font-size: 3.6rem;
font-weight: 800;
line-height: 1.138888889;
}
h2,
.heading-size-2 {
font-size: 3.2rem;
}
h3,
.heading-size-3 {
font-size: 2.8rem;
}
h4,
.heading-size-4 {
font-size: 2.4rem;
}
h5,
.heading-size-5 {
font-size: 2.1rem;
}
h6,
.heading-size-6 {
font-size: 1.6rem;
letter-spacing: 0.03125em;
text-transform: uppercase;
}
p {
line-height: 1.5;
margin: 0 0 1em 0;
}
em,
i,
q,
dfn {
font-style: italic;
}
em em,
em i,
i em,
i i,
cite em,
cite i {
font-weight: bolder;
}
big {
font-size: 1.2em;
}
small {
font-size: 0.75em;
}
b,
strong {
font-weight: 700;
}
ins {
text-decoration: underline;
}
sub,
sup {
font-size: 75%;
line-height: 0;
position: relative;
vertical-align: baseline;
}
sup {
top: -0.5em;
}
sub {
bottom: -0.25em;
}
abbr,
acronym {
cursor: help;
}
address {
line-height: 1.5;
margin: 0 0 2rem 0;
}
hr {
border-style: solid;
border-width: 0.1rem 0 0 0;
border-color: #dcd7ca;
margin: 4rem 0;
}
.entry-content hr,
hr.styled-separator {
background: linear-gradient(to left, currentColor calc(50% - 16px), transparent calc(50% - 16px), transparent calc(50% + 16px), currentColor calc(50% + 16px));
background-color: transparent !important;
border: none;
height: 0.1rem;
overflow: visible;
position: relative;
}
.entry-content hr:not(.has-background),
hr.styled-separator {
color: #6d6d6d;
}
.entry-content hr::before,
.entry-content hr::after,
hr.styled-separator::before,
hr.styled-separator::after {
background: currentColor;
content: "";
display: block;
height: 1.6rem;
position: absolute;
top: calc(50% - 0.8rem);
transform: rotate(22.5deg);
width: 0.1rem;
}
.entry-content hr::before,
hr.styled-separator::before {
left: calc(50% - 0.5rem);
}
.entry-content hr::after,
hr.styled-separator::after {
right: calc(50% - 0.5rem);
}
a {
color: #cd2653;
text-decoration: underline;
}
a:hover,
a:focus {
text-decoration: none;
}
/* Quotes ------------------------------------ */
blockquote {
border-color: #cd2653;
border-style: solid;
/*rtl:ignore*/
border-width: 0 0 0 0.2rem;
color: inherit;
font-size: 1em;
margin: 4rem 0;
/*rtl:ignore*/
padding: 0.5rem 0 0.5rem 2rem;
}
cite {
color: #6d6d6d;
font-size: 1.4rem;
font-style: normal;
font-weight: 600;
line-height: 1.25;
}
blockquote cite {
display: block;
margin: 2rem 0 0 0;
}
blockquote p:last-child {
margin: 0;
}
/* Code -------------------------------------- */
code,
kbd,
pre,
samp {
font-family: monospace;
font-size: 0.9em;
padding: 0.4rem 0.6rem;
}
code,
kbd,
samp {
background: rgba(0, 0, 0, 0.075);
border-radius: 0.2rem;
}
pre {
border: 0.1rem solid #dcd7ca;
line-height: 1.5;
margin: 4rem 0;
overflow: auto;
padding: 3rem 2rem;
text-align: left;
}
pre code {
background: transparent;
padding: 0;
}
/* Inputs ------------------------------------ */
fieldset {
border: 0.2rem solid #dcd7ca;
padding: 2rem;
}
legend {
font-size: 0.85em;
font-weight: 700;
padding: 0 1rem;
}
label {
display: block;
font-size: 1.6rem;
font-weight: 400;
margin: 0 0 0.5rem 0;
}
label.inline,
input[type="checkbox"] + label {
display: inline;
font-weight: 400;
margin-left: 0.5rem;
}
input[type="checkbox"] {
-webkit-appearance: none;
-moz-appearance: none;
position: relative;
top: 2px;
display: inline-block;
margin: 0;
width: 1.5rem;
min-width: 1.5rem;
height: 1.5rem;
background: #fff;
border-radius: 0;
border-style: solid;
border-width: 0.1rem;
border-color: #dcd7ca;
box-shadow: none;
cursor: pointer;
}
input[type="checkbox"]:checked::before {
/* Use the "Yes" SVG Dashicon */
content: url("data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%2020%2020%27%3E%3Cpath%20d%3D%27M14.83%204.89l1.34.94-5.81%208.38H9.02L5.78%209.67l1.34-1.25%202.57%202.4z%27%20fill%3D%27%23000000%27%2F%3E%3C%2Fsvg%3E");
position: absolute;
display: inline-block;
margin: -0.1875rem 0 0 -0.25rem;
height: 1.75rem;
width: 1.75rem;
}
input,
textarea,
button,
.button,
.faux-button,
.wp-block-button__link,
.wp-block-file__button {
font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, sans-serif;
line-height: 1;
}
@supports ( font-variation-settings: normal ) {
input,
textarea,
button,
.button,
.faux-button,
.faux-button.more-link,
.wp-block-button__link,
.wp-block-file__button {
font-family: "Inter var", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, sans-serif;
}
}
input,
textarea {
border-color: #dcd7ca;
color: #000;
}
code,
input[type="url"],
input[type="email"],
input[type="tel"] {
/*rtl:ignore*/
direction: ltr;
}
input[type="text"],
input[type="password"],
input[type="email"],
input[type="url"],
input[type="date"],
input[type="month"],
input[type="time"],
input[type="datetime"],
input[type="datetime-local"],
input[type="week"],
input[type="number"],
input[type="search"],
input[type="tel"],
input[type="color"],
textarea {
-webkit-appearance: none;
-moz-appearance: none;
background: #fff;
border-radius: 0;
border-style: solid;
border-width: 0.1rem;
box-shadow: none;
display: block;
font-size: 1.6rem;
letter-spacing: -0.015em;
margin: 0;
max-width: 100%;
padding: 1.5rem 1.8rem;
width: 100%;
}
select {
font-size: 1em;
}
textarea {
height: 12rem;
line-height: 1.5;
width: 100%;
}
input::-webkit-input-placeholder {
line-height: normal;
}
input:-ms-input-placeholder {
line-height: normal;
}
input::-moz-placeholder {
line-height: revert; /* Reset to the value from the user-agent stylesheet. */
}
input[type="search"]::-webkit-search-decoration,
input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-results-button,
input[type="search"]::-webkit-search-results-decoration {
display: none;
}
button,
.button,
.faux-button,
.wp-block-button__link,
.wp-block-file .wp-block-file__button,
input[type="button"],
input[type="reset"],
input[type="submit"] {
-webkit-appearance: none;
-moz-appearance: none;
background: #cd2653;
border: none;
border-radius: 0;
color: #fff;
cursor: pointer;
display: inline-block;
font-size: 1.5rem;
font-weight: 600;
letter-spacing: 0.0333em;
line-height: 1.25;
margin: 0;
opacity: 1;
padding: 1.1em 1.44em;
text-align: center;
text-decoration: none;
text-transform: uppercase;
transition: opacity 0.15s linear;
}
button:focus,
button:hover,
.button:focus,
.button:hover,
.faux-button:focus,
.faux-button:hover,
.wp-block-button .wp-block-button__link:focus,
.wp-block-button .wp-block-button__link:hover,
.wp-block-file .wp-block-file__button:focus,
.wp-block-file .wp-block-file__button:hover,
input[type="button"]:focus,
input[type="button"]:hover,
input[type="reset"]:focus,
input[type="reset"]:hover,
input[type="submit"]:focus,
input[type="submit"]:hover {
text-decoration: underline;
}
input[type="text"]:focus,
input[type="email"]:focus,
input[type="url"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[type="tel"]:focus,
input[type="range"]:focus,
input[type="date"]:focus,
input[type="month"]:focus,
input[type="week"]:focus,
input[type="time"]:focus,
input[type="datetime"]:focus,
input[type="datetime-local"]:focus,
input[type="color"]:focus,
textarea:focus {
border-color: currentColor;
}
input[type="search"]:focus {
outline: thin dotted;
outline-offset: -4px;
}
<div class="entry-content">
<h2>Headings</h2>
<h1>Header one</h1>
<h2>Header two</h2>
<h3>Header three</h3>
<h4>Header four</h4>
<h5>Header five</h5>
<h6>Header six</h6>
<h2>Blockquotes</h2>
<p>Single line blockquote:</p>
<blockquote><p>Stay hungry. Stay foolish.</p></blockquote>
<p>Multi line blockquote with a cite reference:</p>
<blockquote cite="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/blockquote">
<p>The <strong>HTML <code>&lt;blockquote&gt;</code> Element</strong> (or <em>HTML Block Quotation Element</em>) indicates that the enclosed text is an extended quotation. Usually, this is rendered visually by indentation (see <a href="https://developer.mozilla.org/en-US/docs/HTML/Element/blockquote#Notes">Notes</a> for how to change it). A URL for the source of the quotation may be given using the <strong>cite</strong> attribute, while a text representation of the source can be given using the <a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/cite" title="The HTML Citation Element &lt;cite&gt; represents a reference to a creative work. It must include the title of a work or a URL reference, which may be in an abbreviated form according to the conventions used for the addition of citation metadata."><code>&lt;cite&gt;</code></a> element.</p>
</blockquote>
<p><cite>multiple contributors</cite> &#8211; MDN HTML element reference &#8211; blockquote</p>
<h2>Tables</h2>
<table>
<thead>
<tr>
<th>Employee</th>
<th>Salary</th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<th><a href="http://example.org/">John Doe</a></th>
<td>$1</td>
<td>Because that&#8217;s all Steve Jobs needed for a salary.</td>
</tr>
<tr>
<th><a href="http://example.org/">Jane Doe</a></th>
<td>$100K</td>
<td>For all the blogging she does.</td>
</tr>
<tr>
<th><a href="http://example.org/">Fred Bloggs</a></th>
<td>$100M</td>
<td>Pictures are worth a thousand words, right? So Jane x 1,000.</td>
</tr>
<tr>
<th><a href="http://example.org/">Jane Bloggs</a></th>
<td>$100B</td>
<td>With hair like that?! Enough said&#8230;</td>
</tr>
</tbody>
</table>
<h2>Definition Lists</h2>
<dl>
<dt>Definition List Title</dt>
<dd>Definition list division.</dd>
<dt>Startup</dt>
<dd>A startup company or startup is a company or temporary organization designed to search for a repeatable and scalable business model.</dd>
<dt>#dowork</dt>
<dd>Coined by Rob Dyrdek and his personal body guard Christopher &#8220;Big Black&#8221; Boykins, &#8220;Do Work&#8221; works as a self motivator, to motivating your friends.</dd>
<dt>Do It Live</dt>
<dd>I&#8217;ll let Bill O&#8217;Reilly will <a title="We'll Do It Live" href="https://www.youtube.com/watch?v=O_HyZ5aW76c">explain</a> this one.</dd>
</dl>
<h2>Unordered Lists (Nested)</h2>
<ul>
<li>List item one
<ul>
<li>List item one
<ul>
<li>List item one</li>
<li>List item two</li>
<li>List item three</li>
<li>List item four</li>
</ul>
</li>
<li>List item two</li>
<li>List item three</li>
<li>List item four</li>
</ul>
</li>
<li>List item two</li>
<li>List item three</li>
<li>List item four</li>
</ul>
<h2>Ordered List (Nested)</h2>
<ol start="8">
<li>List item one -start at 8
<ol>
<li>List item one
<ol reversed="reversed">
<li>List item one -reversed attribute</li>
<li>List item two</li>
<li>List item three</li>
<li>List item four</li>
</ol>
</li>
<li>List item two</li>
<li>List item three</li>
<li>List item four</li>
</ol>
</li>
<li>List item two</li>
<li>List item three</li>
<li>List item four</li>
</ol>
<h2>HTML Tags</h2>
<p>These supported tags come from the WordPress.com code <a title="Code" href="http://en.support.wordpress.com/code/">FAQ</a>.</p>
<p><strong>Address Tag</strong></p>
<address>1 Infinite Loop<br />
Cupertino, CA 95014<br />
United States</address>
<p><strong>Anchor Tag (aka. Link)</strong></p>
<p>This is an example of a <a title="Apple" href="http://apple.com">link</a>.</p>
<p><strong>Abbreviation Tag</strong></p>
<p>The abbreviation <abbr title="Seriously">srsly</abbr> stands for &#8220;seriously&#8221;.</p>
<p><strong>Acronym Tag (<em>deprecated in HTML5</em>)</strong></p>
<p>The acronym <acronym title="For The Win">ftw</acronym> stands for &#8220;for the win&#8221;.</p>
<p><strong>Big Tag</strong> (<em>deprecated in HTML5</em>)</p>
<p>These tests are a <big>big</big> deal, but this tag is no longer supported in HTML5.</p>
<p><strong>Cite Tag</strong></p>
<p>&#8220;Code is poetry.&#8221; &#8212;<cite>Automattic</cite></p>
<p><strong>Code Tag</strong></p>
<p>This tag styles blocks of code.<br />
<code>.post-title {<br />
margin: 0 0 5px;<br />
font-weight: bold;<br />
font-size: 38px;<br />
line-height: 1.2;<br />
and here's a line of some really, really, really, really long text, just to see how it is handled and to find out how it overflows;<br />
}</code><br />
You will learn later on in these tests that <code>word-wrap: break-word;</code> will be your best friend.</p>
<p><strong>Delete Tag</strong></p>
<p>This tag will let you <del>strike out text</del>, but this tag is <em>recommended</em> supported in HTML5 (use the <code>&lt;s&gt;</code> instead).</p>
<p><strong>Emphasize Tag</strong></p>
<p>The emphasize tag should <em>italicize</em> <i>text</i>.</p>
<p><strong>Horizontal Rule Tag</strong></p>
<hr />
<p>This sentence is following a <code>&lt;hr /&gt;</code> tag.</p>
<p><strong>Insert Tag</strong></p>
<p>This tag should denote <ins cite="inserted it">inserted</ins> text.</p>
<p><strong>Keyboard Tag</strong></p>
<p>This scarcely known tag emulates <kbd>keyboard text</kbd>, which is usually styled like the <code>&lt;code&gt;</code> tag.</p>
<p><strong>Preformatted Tag</strong></p>
<p>This tag is for preserving whitespace as typed, such as in poetry or ASCII art.</p>
<pre>
<h2>The Road Not Taken</h2>
<cite>Robert Frost</cite>
Two roads diverged in a yellow wood,
And sorry I could not travel both (_/)
And be one traveler, long I stood (='.'=)
And looked down one as far as I could (")_(")
To where it bent in the undergrowth;
Then took the other, as just as fair,
And having perhaps the better claim, |_/|
Because it was grassy and wanted wear; / @ @
Though as for that the passing there ( &gt; º &gt;x&lt;&lt;´
/ O
And both that morning equally lay
In leaves no step had trodden black.
Oh, I kept the first for another day!
Yet knowing how way leads on to way,
I doubted if I should ever come back.
I shall be telling this with a sigh
Somewhere ages and ages hence:
Two roads diverged in a wood, and I—
I took the one less traveled by,
And that has made all the difference.
and here&#039;s a line of some really, really, really, really long text, just to see how it is handled and to find out how it overflows;
</pre>
<p><strong>Quote Tag</strong> for short, inline quotes</p>
<p><q>Developers, developers, developers&#8230;</q> &#8211;Steve Ballmer</p>
<p><strong>Strike Tag</strong> (<em>deprecated in HTML5</em>) and <strong>S Tag</strong></p>
<p>This tag shows <strike>strike-through</strike> <s>text</s>.</p>
<p><strong>Small Tag</strong></p>
<p>This tag shows <small>smaller<small> text.</small></small></p>
<p><strong>Strong Tag</strong></p>
<p>This tag shows <strong>bold<strong> text.</strong></strong></p>
<p><strong>Subscript Tag</strong></p>
<p>Getting our science styling on with H<sub>2</sub>O, which should push the &#8220;2&#8221; down.</p>
<p><strong>Superscript Tag</strong></p>
<p>Still sticking with science and Isaac Newton&#8217;s E = MC<sup>2</sup>, which should lift the 2 up.</p>
<p><strong>Teletype Tag </strong>(<em>obsolete in HTML5</em>)</p>
<p>This rarely used tag emulates <tt>teletype text</tt>, which is usually styled like the <code>&lt;code&gt;</code> tag.</p>
<p><strong>Underline Tag</strong> <em>deprecated in HTML 4, re-introduced in HTML5 with other semantics</em></p>
<p>This tag shows <u>underlined text</u>.</p>
<p><strong>Variable Tag</strong></p>
<p>This allows you to denote <var>variables</var>.</p>
</div><!-- .entry-content -->
/* Lists ------------------------------------- */
ul,
ol {
margin: 0 0 3rem 3rem;
}
ul {
list-style: disc;
}
ul ul {
list-style: circle;
}
ul ul ul {
list-style: square;
}
ol {
list-style: decimal;
}
ol ol {
list-style: lower-alpha;
}
ol ol ol {
list-style: lower-roman;
}
li {
line-height: 1.5;
margin: 0.5rem 0 0 2rem;
}
li > ul,
li > ol {
margin: 1rem 0 0 2rem;
}
.reset-list-style,
.reset-list-style ul,
.reset-list-style ol {
list-style: none;
margin: 0;
}
.reset-list-style li {
margin: 0;
}
dt,
dd {
line-height: 1.5;
}
dt {
font-weight: 700;
}
dt + dd {
margin-top: 0.5rem;
}
dd + dt {
margin-top: 1.5rem;
}
/* Media ------------------------------------- */
figure {
display: block;
margin: 0;
}
iframe {
display: block;
max-width: 100%;
}
video {
display: block;
}
svg,
img,
embed,
object {
display: block;
height: auto;
max-width: 100%;
}
figcaption,
.wp-caption-text {
color: #6d6d6d;
display: block;
font-size: 1.5rem;
font-weight: 500;
line-height: 1.2;
margin-top: 1.5rem;
}
figcaption a,
.wp-caption-text a {
color: inherit;
}
blockquote.instagram-media,
iframe.instagram-media {
margin: auto !important;
}
/* GALLERIES */
.gallery {
display: flex;
flex-wrap: wrap;
margin: 3em 0 3em -0.8em;
width: calc(100% + 1.6em);
}
.gallery-item {
margin: 0.8em 0;
padding: 0 0.8em;
width: 100%;
}
.gallery-caption {
display: block;
margin-top: 0.8em;
}
/* WordPress Image Classes ----------------------------- */
.bg-image {
background-position: center;
background-repeat: no-repeat;
background-size: cover;
}
.bg-attachment-fixed {
background-attachment: fixed;
}
@supports ( -webkit-overflow-scrolling: touch ) {
.bg-attachment-fixed {
background-attachment: scroll;
}
}
@media ( prefers-reduced-motion: reduce ) {
.bg-attachment-fixed {
background-attachment: scroll;
}
}
.wp-block-image.is-resized {
margin-left: auto;
margin-right: auto;
}
/* Cover Modals ------------------------------ */
.cover-modal {
display: none;
-ms-overflow-style: none;
overflow: -moz-scrollbars-none;
}
.cover-modal::-webkit-scrollbar {
display: none !important;
}
.cover-modal.show-modal {
display: block;
cursor: pointer;
}
.cover-modal.show-modal > * {
cursor: default;
}
/* Opacity ----------------------------------- */
.opacity-0 {
opacity: 0;
}
.opacity-5 {
opacity: 0.05;
}
.opacity-10 {
opacity: 0.1;
}
.opacity-15 {
opacity: 0.15;
}
.opacity-20 {
opacity: 0.2;
}
.opacity-25 {
opacity: 0.25;
}
.opacity-30 {
opacity: 0.3;
}
.opacity-35 {
opacity: 0.35;
}
.opacity-40 {
opacity: 0.4;
}
.opacity-45 {
opacity: 0.45;
}
.opacity-50 {
opacity: 0.5;
}
.opacity-55 {
opacity: 0.55;
}
.opacity-60 {
opacity: 0.6;
}
.opacity-65 {
opacity: 0.65;
}
.opacity-70 {
opacity: 0.7;
}
.opacity-75 {
opacity: 0.75;
}
.opacity-80 {
opacity: 0.8;
}
.opacity-85 {
opacity: 0.85;
}
.opacity-90 {
opacity: 0.9;
}
.blend-mode-exclusion {
mix-blend-mode: exclusion;
}
.blend-mode-hue {
mix-blend-mode: hue;
}
.blend-mode-saturation {
mix-blend-mode: saturation;
}
.blend-mode-color {
mix-blend-mode: color;
}
.blend-mode-luminosity {
mix-blend-mode: luminosity;
}
/* Screen Reader Text ------------------------ */
.screen-reader-text {
border: 0;
clip: rect(1px, 1px, 1px, 1px);
-webkit-clip-path: inset(50%);
clip-path: inset(50%);
height: 1px;
margin: -1px;
overflow: hidden;
padding: 0;
position: absolute !important;
width: 1px;
word-wrap: normal !important;
word-break: normal;
}
.screen-reader-text:focus {
background-color: #f1f1f1;
border-radius: 3px;
box-shadow: 0 0 2px 2px rgba(0, 0, 0, 0.6);
clip: auto !important;
-webkit-clip-path: none;
clip-path: none;
color: #21759b;
display: block;
font-size: 0.875rem;
font-weight: 700;
height: auto;
right: 5px;
line-height: normal;
padding: 15px 23px 14px;
text-decoration: none;
top: 5px;
width: auto;
z-index: 100000;
}
/* Search Form ------------------------------- */
.search-form {
align-items: stretch;
display: flex;
flex-wrap: nowrap;
margin: 0 0 -0.8rem -0.8rem;
}
.search-form .search-field,
.search-form .search-submit {
margin: 0 0 0.8rem 0.8rem;
}
.search-form label {
align-items: stretch;
display: flex;
font-size: inherit;
margin: 0;
width: 100%;
}
.search-form .search-field {
width: 100%;
}
.search-form .search-submit {
flex-shrink: 0;
}
.search-form .search-submit:focus,
.search-form .search-submit:hover {
text-decoration: none;
}
/* Social Icons ------------------------------ */
ul.social-icons {
display: flex;
flex-wrap: wrap;
margin: -0.9rem 0 0 -0.9rem;
width: calc(100% + 0.9rem);
}
ul.social-icons li {
margin: 0.9rem 0 0 0.9rem;
}
.social-icons a {
align-items: center;
background: #cd2653;
border-radius: 50%;
color: #fff;
display: flex;
height: 4.4rem;
justify-content: center;
padding: 0;
text-decoration: none;
transition: transform 0.15s ease-in-out;
width: 4.4rem;
}
.social-icons a:focus,
.social-icons a:hover {
transform: scale(1.1);
text-decoration: none;
}
<nav class="social-navigation" role="navigation" aria-label="Social Links Menu">
<div class="menu-social-menu-container">
<ul id="menu-social-menu" class="social-links-menu">
<li id="menu-item-1" class="menu-item menu-item-1">
<a href="http://facebook.com">
<span class="screen-reader-text">Facebook</span>
<i class="fab fa-facebook"></i>
</a>
</li>
<li id="menu-item-2" class="menu-item menu-item-2">
<a href="http://twitter.com">
<span class="screen-reader-text">Twitter</span>
<i class="fab fa-twitter"></i>
</a>
</li>
<li id="menu-item-3" class="menu-item menu-item-3">
<a href="http://github.com">
<span class="screen-reader-text">GitHub</span>
<i class="fab fa-github"></i>
</a>
</li>
<li id="menu-item-4" class="menu-item menu-item-4">
<a href="http://linkedin.com">
<span class="screen-reader-text">LinkedIn</span>
<i class="fab fa-linkedin"></i>
</a>
</li>
<li id="menu-item-5" class="menu-item menu-item-5">
<a href="http://youtube.com">
<span class="screen-reader-text">YouTube</span>
<i class="fab fa-youtube"></i>
</a>
</li>
<li id="menu-item-6" class="menu-item menu-item-6">
<a href="http://vimeo.com">
<span class="screen-reader-text">Vimeo</span>
<i class="fab fa-vimeo"></i>
</a>
</li>
<li id="menu-item-7" class="menu-item menu-item-7">
<a href="http://tumblr.com">
<span class="screen-reader-text">Tumblr</span>
<i class="fab fa-tumblr"></i>
</a>
</li>
</ul>
</div>
</nav>
/* Tables ------------------------------------ */
table {
border: 0.1rem solid #dcd7ca;
border-collapse: collapse;
border-spacing: 0;
empty-cells: show;
font-size: 1.6rem;
margin: 4rem 0;
max-width: 100%;
overflow: hidden;
width: 100%;
}
.alignleft > table {
margin: 0;
}
.alignright > table {
margin: 0;
}
th,
td {
border: 0.1rem solid #dcd7ca;
line-height: 1.4;
margin: 0;
overflow: visible;
padding: 0.5em;
}
caption {
background: #dcd7ca;
font-weight: 600;
padding: 0.5em;
text-align: center;
}
thead {
vertical-align: bottom;
white-space: nowrap;
}
th {
font-weight: 700;
}
/* Toggles ----------------------------------- */
.toggle {
-moz-appearance: none;
-webkit-appearance: none;
color: inherit;
cursor: pointer;
font-family: inherit;
position: relative;
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
text-align: inherit;
user-select: none;
}
button.toggle {
background: none;
border: none;
box-shadow: none;
border-radius: 0;
font-size: inherit;
font-weight: 400;
letter-spacing: inherit;
padding: 0;
text-transform: none;
}
/* Variable Fonts Usage Example --------------------------------- */
@supports ( font-variation-settings: normal ) {
body {
font-family: "Inter var", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, sans-serif;
}
}
/* ----------------------------------------------
Inter variable font. Usage:
@supports (font-variation-settings: normal) {
html { font-family: 'Inter var', sans-serif; }
}
---------------------------------------------- */
@font-face {
font-family: "Inter var";
font-weight: 100 900; /* stylelint-disable-line font-weight-notation */
font-style: normal;
font-display: swap;
src: url(./assets/fonts/inter/Inter-upright-var.woff2) format("woff2");
}
@font-face {
font-family: "Inter var";
font-weight: 100 900; /* stylelint-disable-line font-weight-notation */
font-style: italic;
font-display: swap;
src: url(./assets/fonts/inter/Inter-italic-var.woff2) format("woff2");
}
/* -------------------------------------------------------------------------- */
/* 3. Helper Classes
/* -------------------------------------------------------------------------- */
/* Layout ------------------------------------ */
.no-margin {
margin: 0;
}
.no-padding {
padding: 0;
}
.screen-height {
min-height: 100vh;
}
.admin-bar .screen-height {
min-height: calc(100vh - 32px);
}
@media (max-width: 782px) {
.admin-bar .screen-height {
min-height: calc(100vh - 46px);
}
}
.screen-width {
position: relative;
left: calc(50% - 50vw);
width: 100vw;
}
/* Sections ---------------------------------- */
section {
padding: 5rem 0;
width: 100%;
}
.section-inner {
margin-left: auto;
margin-right: auto;
max-width: 120rem;
width: calc(100% - 4rem);
}
.section-inner.max-percentage {
width: 100%;
}
.section-inner.thin {
max-width: 58rem;
}
.section-inner.small {
max-width: 80rem;
}
.section-inner.medium {
max-width: 100rem;
}
.section-inner.no-margin {
margin: 0;
}
/* Hiding and Showing ------------------------ */
.js .show-js {
display: block !important;
}
.js .hide-js {
display: none !important;
}
.no-js .show-no-js {
display: block !important;
}
.no-js .hide-no-js {
display: none !important;
}
/* Typography -------------------------------- */
.font-size-xl {
font-size: 1.25em;
}
.font-size-xs {
font-size: 0.8em;
}
.no-select {
-webkit-touch-callout: none;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
/* Colors ------------------------------------ */
/* COLOR */
.color-accent,
.color-accent-hover:focus,
.color-accent-hover:hover {
color: #cd2653;
}
/* BACKGROUND COLOR */
.bg-accent,
.bg-accent-hover:focus,
.bg-accent-hover:hover {
background-color: #cd2653;
}
/* BORDER COLOR */
.border-color-accent,
.border-color-accent-hover:focus,
.border-color-accent-hover:hover {
border-color: #cd2653;
}
/* FILL COLOR */
.fill-children-accent,
.fill-children-accent * {
fill: #cd2653;
}
.fill-children-current-color,
.fill-children-current-color * {
fill: currentColor;
}
<?php
/**
* Function to programmatically create a new post with a custom post type.
*
* @link ref https://wordpress.stackexchange.com/questions/106973/wp-insert-post-or-similar-for-custom-post-type/151581
* @link seealso https://developer.wordpress.org/reference/functions/wp_insert_post/
*/
function wp_insert_CPT() {
// Get today's date and create a title from it.
$today = date( "M j, Y" );
$title = "Challenge: " . $today;
/*
* Create the post content. Content will include:
* - 20-30 vocab words
* - 3 grammar points
* - 3 phrases
* - 1 reading
* - 1 writing
* - 1 speaking challenge
*/
$content = '';
// Assign custom taxonomies.
$hierarchical_tax = array( 13, 10 ); // Array of tax ids.
$non_hierarchical_terms = 'tax name 1, tax name 2'; // Can use array of ids or string of tax names separated by commas.
/*
* Default args:
$defaults = array(
'post_author' => $user_id,
'post_content' => '',
'post_content_filtered' => '',
'post_title' => '',
'post_excerpt' => '',
'post_status' => 'draft',
'post_type' => 'post',
'comment_status' => '',
'ping_status' => '',
'post_password' => '',
'to_ping' => '',
'pinged' => '',
'post_parent' => 0,
'menu_order' => 0,
'guid' => '',
'import_id' => 0,
'context' => '',
);
*/
// Create the post and insert it into the database.
// Returns a $post_id if successful.
$post_id = wp_insert_post(
array (
'post_type' => 'k2k-daily',
'post_title' => $title,
'post_content' => $content,
'post_date' => date( 'Y-m-d H:i:s', time() ),
'post_date_gmt' => date( 'Y-m-d H:i:s', time() ),
'post_status' => 'publish',
'comment_status' => 'closed', // if you prefer.
'ping_status' => 'closed', // if you prefer.
'tax_input' => array(
'hierarchical_tax' => $hierarchical_tax,
'non_hierarchical_tax' => $non_hierarchical_terms,
),
'meta_input' => array(
'test_meta_key' => 'value of test_meta_key', // One way to add post meta, on post creation.
),
)
);
// Another way to add post meta, after post creation.
if ( $post_id ) {
// insert post meta.
add_post_meta( $post_id, '_your_custom_1', $custom1 );
add_post_meta( $post_id, '_your_custom_2', $custom2 );
add_post_meta( $post_id, '_your_custom_3', $custom3 );
}
// One way to do error checking.
if ( ! is_wp_error( $post_id ) ) {
// the post is valid.
} else {
// there was an error in the post insertion,.
echo $post_id->get_error_message();
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment