Meta Tags, HTACCESS Rules And Other Quick Copy Codes
More Meta and OG Tags
Meta Refresh Redirect
Robots TXT Allow MSE
Favorite Tools
Add Logo To Login Page
Home Icon Code
WP Shortcode Function
WordPress Video player code
WordPress Audio Player with Download Button
PHP Current Year
Redirect 404’s to HomePage via Htaccess
Meta NoIndex NoFollow
<meta name="robots" content="noindex, nofollow">
More Meta Tags
<title>One Page HTML</title> <meta name="description" content="Free One Page HTML Code"> <meta name="author" content="OnePageHTML.com"> <!-- Get this code at https://onepagehtml.com --> <meta property="og:url" content="https://onepagehtml.com" /> <meta property="og:type" content="article" /> <meta property="og:title" content="One Page HTML Template" /> <meta property="og:description" content="Free One Page HTML Template" /> <meta property="og:image" content="https://onepagehtml.com/onepagehtml.jpg" />
Meta Refresh Redirect
<!DOCTYPE html> <html><head> <title>Redirect Page</title> <meta http-equiv="REFRESH" content="0;url=https://imcodex.com?replaceurl"> </HEAD> <BODY> </BODY> </HTML>
Allow Major Search Engines, Block All Others
(with some disallow samples)
# Allow Major SE User-agent: Googlebot User-agent: bingbot User-agent: Slurp User-agent: msnbot User-agent: DuckDuckBot Disallow: Disallow: /add-directory Disallow: /filename.php Disallow: /*.pdf Disallow: /*? Crawl-delay: 15 # Block All Other Bots User-agent: * Disallow: /
Restrict WP-Login Access By IP
(add your ips where 123 is)
<Files wp-login.php> order deny,allow deny from all allow from 123.456.78.1 allow from 123.456.78.2 </Files> # you may need these lines to prevent redirects ErrorDocument 401 default ErrorDocument 403 default ErrorDocument 404 default
WP Shortcode Function
Add this code to a functions.php file or use a Custom Snippets plugin. It will let you create your own shortcodes for ads, buttons etc. This creates a shortcode [imcodex] which will display the text Add Any HTML Code or Script Here when used.
function mycustom_function() {
return '<b>Add Any HTML Code or Script Here</b>
';
}
add_shortcode('imcodex', 'mycustom_function');
Add Logo To WordPress Login Page
This is my code, replace image and sizes
function my_login_logo() { ?>
<style type="text/css">
#login h1 a, .login h1 a {
background-image: url(https://imcodex.com/wp-content/uploads/2016/05/imcodex.png);
height:82px;
width:284px;
background-size: 284px 82px;
background-repeat: no-repeat;
padding-bottom: 30px;
}
</style>
<?php }
add_action( 'login_enqueue_scripts', 'my_login_logo' );
Socrates Theme – Home Icon Code
I use this as the home menu icon “link text” on all Socrates Theme installs.
<i class="fa fa-home-menu" aria-hidden="true"></i>
WordPress Video player code. No 3rd party player needed.
<div align="center"> <video poster="https://yourdomain.com/videocover.jpg" controls="controls" width="100%" height="auto"> <source src="https://yourdomain.com/video.mp4" type="video/mp4"></video> </div>
AWS Bucket Policy to protect content by referring domain only.
{
"Version": "2012-10-17",
"Id": "Policy1414368633278",
"Statement": [
{
"Sid": "Stmt1414368595009",
"Effect": "Allow",
"Principal": {
"AWS": "*"
},
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::yourbucketname/*",
"Condition": {
"StringLike": {
"aws:Referer": "https://yourdomain.com/*"
}
}
}
]
}
WordPress Audio Player with Download Button in Two Column Layout
This uses the Socrates Toolkit plugin for columns and button, but any column shortcode and button plugin will work.
The Audio shortcode is core WordPress and the design can be customized using custom css.
Here’s the code. Remove the word REMOVE from shortcode example so it’s just audio. My syntax highlighter doesn’t like the nested embed..
[soc_two_third] [audioREMOVE src="https://s3.amazonaws.com/simple3x/testaudio.mp3"] [/soc_two_third] [soc_one_third class='last'] [soc_button color='ghost' size='normal' href='https://s3.amazonaws.com/simple3x/testaudio.mp3' align='left' rel='']Download Audio[/soc_button] [/soc_one_third]
Example CSS for Custom Background and Border Radius for Audio Player (not applied above)
.mejs-container, .mejs-container .mejs-controls, .mejs-embed, .mejs-embed body {background: #1e73be!important;border-radius: 3px;}
PHP Current Year
Automatically add the current year to copyright notices inside of templates. (Not in WP posts)
<?php echo date("Y"); ?>
Redirect 404’s to Specific Page
If you want to recapture 404 traffic and redirect it your a specific page add this to your htaccess file.
This is useful if you’re downsizing an old domain to one landing page and want to capture all your site’s old traffic from old links.
ErrorDocument 404 /index.php
Favorite Free Tools/Links
- WinMerge – Compare Files and Folders for change
- NotePad++ – Awesome Text Editor (my fav tool ever)
- WinSCP – Free FTP Program
- Password Generator – My Own Password Generator
- Cookie Consent Generator – Generate cookie consent code
- Privacy Policy – Free (or paid) Privacy Policy generator