Skip to content

Instantly share code, notes, and snippets.

#internal test
This is form test #1, mobile/desktop/sidebar/footer form, project #xxxxx.
#external test
This is form test #1, mobile/desktop/sidebar/footer form, project #xxxxx. Please notify the Client Services Department at clientservices@ceatus.com that you have received this message. Thank you.
add_filter('redirect_canonical', 'no_redirect_on_404');
function no_redirect_on_404($redirect_url)
{
if (is_404()) {
return false;
}
return $redirect_url;
}
RewriteEngine On
#error 410
ErrorDocument 410 default
#redirect home page to specific page without redirecting other urls
RewriteRule ^/?$ http://domain.com/folder/page/ [L,R]
#redirect www to non wwww
RewriteCond %{HTTP_HOST} ^www.domain.com [NC]
RewriteRule ^(.*) http://domain.com/$1 [L,R=301]
/* [schemaaddress business='' streetaddress='' addresslocality='' addressregion='' postalcode='' telephone=''] */
function schemaaddress_shortcode($atts) {
extract(shortcode_atts(array(
"business"=> '1',
"streetaddress"=> '2',
"addresslocality"=> '3',
"addressregion"=> '4',
"postalCode"=> '5',
"telephone"=> '6',
), $atts));
UPDATE users SET pass = md5(‘newpassword’) WHERE uid = 1;
<?php
$args = array(
'numberposts' => 2,
'orderby' => 'post_date',
'order' => 'DESC',
'post_type' =>' post' );
$recent_posts = wp_get_recent_posts( $args );
foreach( $recent_posts as $recent ){
# very top of header.php file
# can use page ID
<?php if(is_page('58')){
header("HTTP/1.1 301 Moved Permanently");
header("Status: 301 Moved Permanently");
header("Location: http://www.domain.com/es/lasik/");
header("Connection: close");
exit(0); // Optional, prevents any accidental output
}
# or page slug
function your_admin_notice(){
echo '<div class="update-nag">
<p style="color:green;"><span style="color:red;">DO NOT UPDATE NEXTGEN WITHOUT FIRST READING THE COMMENTS IN THE NEXTGEN CUSTOM THEME FILE.</span><br /><em>The file is in the themes folder "/themes/arykrau_desktop/nggallery/nextgen_basic_imagebrowser-BAK.php"</em></p>
</div>';
}
add_action('admin_notices', 'your_admin_notice');
#the information in this notice MUST BE CUSTOMIZED PER SITE
function your_admin_notice(){
echo '<div class="update-nag">
<p><strong>Version Control:</strong> <span style="color:green; font-weight: bold;">ACTIVE</span></p>
<p><strong>Mobile Site:</strong> <span style="color:green; font-weight: bold;">YES - Responsive/Theme Switcher/Third Party</span> / <span style="color:red; font-style:italic;">NO</span></p>
<p><strong>CMG CDN JS Enqueued:</strong> <span style="color:green; font-weight: bold;">YES</span> / <span style="color:red; font-style:italic;">NO - Enqueued, Not CDN OR CDN, Not enqueued</span></p>
<p><strong>HTML5 Form Validation:</strong> <span style="color:green; font-weight: bold;">YES</span></p>
<p><strong>SCSS:</strong> <span style="color:green; font-weight: bold;">YES</span></p>#remove this line is SCSS is not used
<p><strong>Foundation:</strong> <span style="color:green; font-weight: bold;">YES</span></p>#remove this line if Foundation is not used
<?php if ( is_user_logged_in() ) { } else { ?>
<div style="opacity:0.75;font-size:22px;text-align:center;display:block;padding:20px;background:#F00;color:#fff;position:fixed;bottom:50px;width:100%;z-index:9999;margin-top:30px;">
<strong>NOTE:</strong> This site is currently in under production and has not passed quality control.
</div>
<?php } ?>