This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For images | |
$siteMailLogoURL = NULL; | |
$siteMainLogoAlt = NULL; | |
if (isset($siteMainLogoID)) { | |
$siteMailLogoURL = wp_get_attachment_url($siteMainLogoID); | |
$siteMainLogoAlt = get_post_meta($siteMainLogoID, '_wp_attachment_image_alt', true); | |
} | |
if (!empty($siteMailLogoURL)) : ?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="text/javascript"> | |
document.addEventListener( 'wpcf7mailsent', function( event ) { | |
if (typeof gtag !== 'undefined') { | |
gtag('event', 'Submit', { | |
'event_category': 'Contact Form', | |
'event_label': 'Main Contact Form', | |
'event_callback': function() { | |
console.log("contact form tracking sent successfully"); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# force HTTPS and www. | |
RewriteEngine On | |
RewriteCond %{HTTPS} off [OR] | |
RewriteCond %{HTTP_HOST} !^www\. [NC] | |
RewriteCond %{HTTP_HOST} ^(?:www\.)?(.+)$ [NC] | |
RewriteRule ^ https://www.%1%{REQUEST_URI} [L,NE,R=301] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$start = microtime(true); | |
// code here | |
$time_elapsed_secs = microtime(true) - $start; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Redirect HTTP to HTTPS | |
RewriteCond %{HTTPS} !=on | |
RewriteRule (.*) https://%{SERVER_NAME}/$1 [R,L] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$originalString = "Test String"; | |
$stringInParts = explode(' ', $originalString); | |
$originalString = '<span>' . $stringInParts[0] . '</span>' . Implode(" ", array_slice($stringInParts,1)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This example is for a section called theme options, with a setting for copyright text | |
$wp_customize->add_section( 'theme_options_section' , array( | |
'title' => __('Theme Options','themename'), | |
'priority' => 30, | |
) ); | |
$wp_customize->add_setting( 'copyright_text' , array( | |
'default' => 'Default text here' | |
) ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Redirect HTTP to HTTPS | |
RewriteCond %{HTTPS} !=on | |
RewriteRule (.*) https://%{SERVER_NAME}/$1 [R,L] | |
# BEGIN WordPress | |
<IfModule mod_rewrite.c> | |
RewriteEngine On | |
RewriteBase / | |
RewriteRule ^index\.php$ - [L] | |
RewriteCond %{REQUEST_FILENAME} !-f |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// remove jquery migrate | |
add_filter( 'wp_default_scripts', 'dequeue_jquery_migrate' ); | |
function dequeue_jquery_migrate( &$scripts){ | |
if(!is_admin()){ | |
$scripts->remove( 'jquery'); | |
$scripts->add( 'jquery', false, array( 'jquery-core' ), '1.10.2' ); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<h1><?php the_title(); ?></h1> | |
<?php $paged = ( get_query_var('paged') ) ? get_query_var('paged') : 1; | |
$query = new WP_Query( array('posts_per_page' => 5, 'paged' => $paged, 'orderby'=>'date','order'=>'DESC') ); | |
while ( $query->have_posts() ) : $query->the_post(); | |
$hasPostThumb = ''; | |
if (has_post_thumbnail()){ | |
$hasPostThumb = true; | |
} | |
?> |
NewerOlder