Skip to content

Instantly share code, notes, and snippets.

# HTTPS to HTTP Redirect - put the snippet top of .htaccess file
RewriteEngine On
RewriteCond %{HTTPS} on
RewriteRule (.*) http://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
RewriteEngine on
RewriteCond %{HTTP_HOST} ^example.co.uk [NC]
RewriteRule ^(.*)$ https://example.co.uk/$1 [L,R=301]
@itsnahidhasan
itsnahidhasan / Meta-hreflang-tag-example
Created July 2, 2019 11:06
Meta hreflang tag example
// Meta hreflang tag example: Add this code to the <head> section of every page
<link rel="alternate" href="http://example.com/"
hreflang="en" />
// Targetting uk English speaking users
<link rel="alternate" href="http://example.com/en-gb/"
hreflang="en-gb" />
//targettign English speaking Australian users
<link rel="alternate" href="http://example.com/en-au/"
hreflang="en-au" />
/** paginated page indexation fixing - paste it to function.php file**/
function mushfiqco_paginated_page_fix() {
if(is_paged()) echo '<meta name="robots" content="noindex,follow"/>';}
add_action('wp_head', 'mushfiqco_paginated_page_fix');
@itsnahidhasan
itsnahidhasan / HTML-Sitemap-for-Genesis-Framework.php
Last active July 1, 2019 08:02
Creating an HTML sitemap is a good practice. In Genesis framework its easy to create one. Here is the file.
<?php
/**
* Genesis Framework.
*
* WARNING: This file is part of the core Genesis Framework. DO NOT edit this file under any circumstances.
* Please do all modifications in the form of a child theme.
*
* @package Genesis\Templates
* @author The mushfiq.co
* @license GPL-2.0+
@itsnahidhasan
itsnahidhasan / Remove-post-title-from-bredcrumb.php
Created October 17, 2017 16:44
Genesis Breadcrumb Code Snippets
/**
* Remove Post Title from Breadcrumb.
*
* Takes a substring of crumb, starting at 0, with a length of up to the last occurrence of the
* (start of the) separator string.
*/
function be_remove_title_from_single_crumb( $crumb, $args ) {
return substr( $crumb, 0, strrpos( $crumb, $args['sep'] ) );
}
add_filter( 'genesis_single_crumb', 'be_remove_title_from_single_crumb', 10, 2 );
@itsnahidhasan
itsnahidhasan / genesis-related-post-with-thumbnail.php
Last active September 11, 2017 11:58
Genesis related posts code snippets with thumbnail image
add_action( 'genesis_after_entry_content', 'sk_related_posts', 12 );
function sk_related_posts() { global $do_not_duplicate;
if ( ! is_singular ( 'post' ) ) { return; }
$count = 0; $related = ''; $do_not_duplicate = array(); $cats = wp_get_post_categories( get_the_ID() );
// If we have some categories and less than 5 posts, run the cat query.
@itsnahidhasan
itsnahidhasan / genesis-custom-footer-credit.php
Created August 18, 2017 12:04
Genesis Custom footer credit
@itsnahidhasan
itsnahidhasan / contactform-7-with-placeholder.html
Last active August 18, 2017 11:17
Contact form 7 with placeholder
[text your-name placeholder "Your name"]
[email* your-email placeholder "eMail Address"]
[textarea your-message placeholder "Your Message"]
[submit "Send it Now"]
<style>
input[type=text], input[type=email], textarea {
background: none;
@itsnahidhasan
itsnahidhasan / blogger-contact-from-snippet.html
Last active June 17, 2017 13:57
Blogger Contact Form Code Snippet
<style>
.contact-form-name,
.contact-form-email,
.contact-form-email-message {
max-width: 100%;
}
input[type=text], select, textarea {
width: 100%;
padding: 12px;
border: 1px solid #ccc;