Python programming in context / Bradley N. Miller, David L. Ranum, Julie Anderson
Report of the statutory review of the Enhancing Online Safety Act 2015 and the review of schedules 5 and 7 to the Broadcasting Services Act 1992 (Online Content Scheme) / Lynelle Briggs AO
Women and travel : historical and contemporary perspectives / edited by Catheryn Khoo-Lattimore, PhD ; Erica Wilson, PhD
Contemporary politics in the Middle East / Beverley Milton-Edwards
Effective SEO and Content Marketing: The Ultimate Guide for Maximizing Free Web Traffic
Get beyond the basics and see how modern-day users are reimaging the SEO process SEO is often underutilized and overlooked across the marketing realm today. SEO is not merely trying to improve your website ranking on Google, but it can spark and optimize ideas. Above all it can help improve the amount of free traffic coming to your web properties. This book provides you with a comprehensive approach to make sure marketing spend is utilized as effectively Read More... |
The New Rules of Marketing and PR: How to Use Content Marketing, Podcasting, Social Media, AI, Live Video, and Newsjacking to Reach Buyers Directly, 7th Edition
The seventh edition of the pioneering guide to generating attention for your idea or business, packed with new and updated information In the Digital Age, marketing tactics seem to change on a day-to-day basis. As the ways we communicate continue to evolve, keeping pace with the latest trends in social media, the newest online videos, the latest mobile apps, and all the other high-tech influences can seem an almost impossible task. How can you keep Read More... |
Contesting Leviathan: activists, hunters, and state power in the Makah whaling conflict / Les Beldo
Proving and interpreting the spontaneous formation of bulk nanobubbles in aqueous organic solvent solutions: effects of solvent type and content
DOI: 10.1039/D0SM00111B, Paper
We show that the mixing of organic solvents with pure water leads to the spontaneous formation of bulk nanobubbles which exhibit long-term stability on the scale of months.
To cite this article before page numbers are assigned, use the DOI form of citation above.
The content of this RSS Feed (c) The Royal Society of Chemistry
Learning one's native tongue: citizenship, contestation, and conflict in America / Tracy B. Strong
Defending a Contested Ideal: Merit and the Public Service Commission, 1908-2008
Corruption in contemporary politics: a new travel guide / James L. Newell
Contemporary US populism in comparative perspective / Kirk Hawkins, Levente Littvay
Sikkim sets up cell to monitor social media content
SC orders V K Singh to explain 'serious statements', begins hearing contempt case
Convex functions and their applications [electronic resource] : a contemporary approach / Constantin Niculescu, Lars-Erik Persson
Contemporary cryptology [electronic resource] / Dario Catalano [and others]
Energy, resource extraction and society : impacts and contested futures / edited by Anna Szolucha
Contested extractivism, society and the state : struggles over mining and land / Bettina Engels, Kristina Dietz, editors
Horace Lurton Papers [Revised Finding Aid: Digitized Content Added]
Associate justice of the United States Supreme Court. Correspondence and telegrams, some written while Lurton was attending the University of Chicago (1857-1886) and while he was a prisoner in Camp Chase, Ohio, and at Johnson Island Prison during the Civil War.
Contemporary U.S. Latinx literature in Spanish: straddling identities / Amrita Das, Kathryn Quinn-Sánchez, Michele Shaul, editors
There's a profusion of movie stars contesting 2014 polls
Movie stars in 2014's polls are a welcome addition to the fray. For those carping about how stars represent glamour and gloss, why not?
Contesting hidden waters : conflict resolution for groundwater and aquifers / W. Todd Jarvis
Paul's corporate Christophany : an evaluation of Paul's Christophanic references in their epistolary contexts / Rob A. Fringer
The Mysteries, resurrection, and 1 Corinthians 15 : comparative methodology and contextual exegesis / Terri Moore
The earliest perceptions of Jesus in context : essays in honour of John Nolland on his 70th birthday / edited by Aaron W. White, Craig A. Evans and David Wenham
Admen and Eve : the Bible in contemporary advertising / Katie B. Edwards
Jesus, skepticism & the problem of history : criteria & context in the study of Christian origins / Darrell L. Bock and J. Ed Komoszewski, editors ; foreword by N.T. Wright
The making of Christian morality : reading Paul in ancient and modern contexts / David G. Horrell
Troublesome texts : the Bible in colonial and contemporary culture / R.S. Sugirtharajah
Story as history--history as story : the gospel tradition in the context of ancient oral history / by Samuel Byrskog
The contest for time and space in the Roman imperial cults and 1 Peter : reconfiguring the universe / Wei Hsien Wan
Handbook of global contemporary Christianity : movements, institutions, and allegiance / edited by Stephen Hunt
Essential essays for the study of the military in first-century Palestine : soldiers and the New Testament context / edited by Christopher B. Zeichman
Using HTML5 elements in WordPress post content
Here are two ways to include HTML5 elements in your WordPress post content
without WordPress’ wpautop
function wrapping them in p
tags or littering
your code with line breaks.
HTML5 has several new elements that you may want to use in your post content to markup document sections, headers, footers, pullquotes, figures, or groups of headings. One way to safely include these elements in your posts is simple; the other way is a bit more complicated. Both ways rely on hand-coding the HTML5 markup in the WordPress editor’s HTML view.
If you are adding HTML5 elements to your post content then you should use an HTML5 doctype.
Disable wpautop
for your theme
This is the simple way. Disable the wpautop
function so that WordPress makes
no attempt to correct your markup and leaves you to hand-code every line of
your posts. If you want total control over every line of your HTML then this is
the option for you.
To disable wpautop
entirely add these lines to your theme’s
functions.php
:
remove_filter('the_excerpt', 'wpautop');
remove_filter('the_content', 'wpautop');
However, wpautop
is generally quite useful if most of your posts are simple
text content and you only occasionally want to include HTML5 elements.
Therefore, modifying wpautop
to recognise HTML5 elements might be more
practical.
Modify wpautop
to recognise HTML5 elements
WordPress’ wpautop
is part of the core functions and can be found in this
file within your WordPress installation: wp-includes/formatting.php
. It
controls how and where paragraphs and line breaks are inserted in excerpts and
post content.
In order to create a modified version of WordPress’ core wpautop
function I
started off by duplicating it in my theme’s functions.php
file.
What I’ve experimented with is disabling wpautop
and adding a modified copy
of it – which includes HTML5 elements in its arrayss – to my theme’s
functions.php
file.
Add the following to your theme’s functions.php
file and you’ll be able to
use section
, article
, aside
, header
, footer
, hgroup
, figure
,
details
, figcaption
, and summary
in your post content. (Probably best to
try this in a testing environment first!)
/* -----------------------------
MODIFIED WPAUTOP - Allow HTML5 block elements in wordpress posts
----------------------------- */
function html5autop($pee, $br = 1) {
if ( trim($pee) === '' )
return '';
$pee = $pee . "
"; // just to make things a little easier, pad the end
$pee = preg_replace('|<br />s*<br />|', "
", $pee);
// Space things out a little
// *insertion* of section|article|aside|header|footer|hgroup|figure|details|figcaption|summary
$allblocks = '(?:table|thead|tfoot|caption|col|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|map|area|blockquote|address|math|style|input|p|h[1-6]|hr|fieldset|legend|section|article|aside|header|footer|hgroup|figure|details|figcaption|summary)';
$pee = preg_replace('!(<' . $allblocks . '[^>]*>)!', "
$1", $pee);
$pee = preg_replace('!(</' . $allblocks . '>)!', "$1
", $pee);
$pee = str_replace(array("
", "
"), "
", $pee); // cross-platform newlines
if ( strpos($pee, '<object') !== false ) {
$pee = preg_replace('|s*<param([^>]*)>s*|', "<param$1>", $pee); // no pee inside object/embed
$pee = preg_replace('|s*</embed>s*|', '</embed>', $pee);
}
$pee = preg_replace("/
+/", "
", $pee); // take care of duplicates
// make paragraphs, including one at the end
$pees = preg_split('/
s*
/', $pee, -1, PREG_SPLIT_NO_EMPTY);
$pee = '';
foreach ( $pees as $tinkle )
$pee .= '<p>' . trim($tinkle, "
") . "</p>
";
$pee = preg_replace('|<p>s*</p>|', '', $pee); // under certain strange conditions it could create a P of entirely whitespace
// *insertion* of section|article|aside
$pee = preg_replace('!<p>([^<]+)</(div|address|form|section|article|aside)>!', "<p>$1</p></$2>", $pee);
$pee = preg_replace('!<p>s*(</?' . $allblocks . '[^>]*>)s*</p>!', "$1", $pee); // don't pee all over a tag
$pee = preg_replace("|<p>(<li.+?)</p>|", "$1", $pee); // problem with nested lists
$pee = preg_replace('|<p><blockquote([^>]*)>|i', "<blockquote$1><p>", $pee);
$pee = str_replace('</blockquote></p>', '</p></blockquote>', $pee);
$pee = preg_replace('!<p>s*(</?' . $allblocks . '[^>]*>)!', "$1", $pee);
$pee = preg_replace('!(</?' . $allblocks . '[^>]*>)s*</p>!', "$1", $pee);
if ($br) {
$pee = preg_replace_callback('/<(script|style).*?</\1>/s', create_function('$matches', 'return str_replace("
", "<WPPreserveNewline />", $matches[0]);'), $pee);
$pee = preg_replace('|(?<!<br />)s*
|', "<br />
", $pee); // optionally make line breaks
$pee = str_replace('<WPPreserveNewline />', "
", $pee);
}
$pee = preg_replace('!(</?' . $allblocks . '[^>]*>)s*<br />!', "$1", $pee);
// *insertion* of img|figcaption|summary
$pee = preg_replace('!<br />(s*</?(?:p|li|div|dl|dd|dt|th|pre|td|ul|ol|img|figcaption|summary)[^>]*>)!', '$1', $pee);
if (strpos($pee, '<pre') !== false)
$pee = preg_replace_callback('!(<pre[^>]*>)(.*?)</pre>!is', 'clean_pre', $pee );
$pee = preg_replace( "|
</p>$|", '</p>', $pee );
return $pee;
}
// remove the original wpautop function
remove_filter('the_excerpt', 'wpautop');
remove_filter('the_content', 'wpautop');
// add our new html5autop function
add_filter('the_excerpt', 'html5autop');
add_filter('the_content', 'html5autop');
The results are not absolutely perfect but then neither is the original
wpautop
function. Certain ways of formatting the code will result in unwanted
trailing </p>
tags or a missing opening <p>
tags.
For example, to insert a figure with caption into a post you should avoid
adding the figcaption
on a new line because an image or link appearing before
the figcaption
will end up with a trailing </p>
.
<!-- this turns out ok -->
<figure>
<a href="#"><img src="image.jpg" alt="" /></a><figcaption>A figure caption for your reading pleasure</figcaption>
</figure>
<!-- this turns out not so ok -->
<figure>
<a href="#"><img src="image.jpg" alt="" /></a>
<figcaption>A figure caption for your reading pleasure</figcaption>
</figure>
Another example would be when beginning the contents of an aside
with a
paragraph. You’ll have to leave a blank line between the opening aside
tag
and the first paragraph.
<aside>
This content could be a pullquote or information that is tangentially related to the surrounding content. But to get it wrapped in a paragraph you have to leave those blank lines either side of it before the tags.
</aside>
Room for improvement
Obviously there are still a few issues with this because if you format your post content in certain ways then you can end up with invalid HTML, even if it doesn’t actually affect the rendering of the page. But it seems to be pretty close!
Leave a comment or email me if you are using this function and find there that are instances where it breaks down. I ran numerous tests and formatting variations to try and iron out as many problems as possible but it’s unlikely that I tried or spotted everything.
Hopefully someone with more PHP and WordPress experience will be able to
improve upon what I’ve been experimenting with, or find a simpler and more
elegant solution that retains the useful wpautop
functionality while allowing
for the use of HTML5 elements in posts. Please share anything you find!
Contempt: a memoir of the Clinton investigation / Ken Starr
Contemporary issues of human rights protection in international and national settings / Stefan Lorenzmaier, Vasilka Sancin (eds.)
Megaregulation contested: global economic ordering after TPP / edited by Benedict Kingsbury, David M. Malone, Paul Mertenskötter, Richard B. Stewart, Thomas Streinz, Atsushi Sunami
Por una Asamblea Constituyente: mecanismos, procesos y contenidos para una nueva Constitución / Francisco Quiero, Jaime Gajardo, compiladores
Film studies in China : selected writings from Contemporary cinema / copy editor, Emma Rhys
Transforming mathematics problems in Indonesian primary schools by embedding Islamic and Indonesian contexts / Neni Mariana
Bilateralism, multilateralism and Asia-Pacific security : contending cooperation / edited by William T. Tow and Brendan Taylor
Contemporary Malaysian Indians : history, issues, challenges & prospects / edited by Denison Jayasooria, K.S. Nathan
Fragmented vision : culture and politics in contemporary Malaysia / editors, Joel S. Kahn, Francis Loh Kok Wah
The Official ACT Prep Guide 2020 - 2021, (Book + 5 Practice Tests + Bonus Online Content)
The only guide from the ACT organization, the makers of the exam, with 5 genuine, full-length practice tests in print and online. The Official ACT Prep Guide 2020-2021 is the only guide from the makers of the exam and it includes actual ACT test forms (taken from past ACT exams). It offers 5 actual ACT tests (all with optional writing tests) so you can practice at your own pace. To help you review, this guide provides detailed explanations for every Read More... |