Skip to content

Instantly share code, notes, and snippets.

View jimmy89Li's full-sized avatar

Li jimmy89Li

View GitHub Profile
@jimmy89Li
jimmy89Li / web.config
Created August 11, 2017 09:14
Microsoft Server IIS - Wordpress Upload Limit (Set upload limit to 120M)
<configuration>
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="120000000" />
</requestFiltering>
</security>
</system.webServer>
</configuration>
<table class="countdown" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td>25-12-2017 12:00</td>
</tr>
</tbody>
</table>
<script>
$('.countdown').each(function(index){
@jimmy89Li
jimmy89Li / categoryUpdatedDate.php
Created May 10, 2017 10:45
Update updatedDate for last updated Category
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$wpdb->query("UPDATE wp_terms SET updatedDate=NOW() WHERE term_id='".$_POST['tag_ID']."'");
}
@jimmy89Li
jimmy89Li / selectUpdatedLastHour.sql
Created May 10, 2017 09:11
Select from database where updatedDate was done in the last 60 minutes
SELECT * FROM wp_terms WHERE updatedDate > (now() - interval 60 minute);
@jimmy89Li
jimmy89Li / divHeight.js
Created March 30, 2017 10:03
Div height based on other div height
var secondTop = (($(window).width())<660) ? ($('.subscribe').outerHeight()/2) : 160;
$('.second .topPattern').height(secondTop);
@jimmy89Li
jimmy89Li / halfDivBottom.js
Created March 30, 2017 10:02
Margin bottom -half of div size
var subscribeOffset = ($('.subscribe').outerHeight()/2)*-1;
$('.subscribe').css('bottom',subscribeOffset+'px');
@jimmy89Li
jimmy89Li / halfWindowSize.js
Created March 30, 2017 10:00
Resize div based on windows size - half of window size or 560px of smaller then 560x2
var h = (($(window).height()/2)<560) ? 560 : $(window).height()/2;
$('.header').height(h);
@jimmy89Li
jimmy89Li / resizer.js
Created March 30, 2017 09:58
jQuery resize trigger
$( window ).resize(function() {
...
});
$(function(){
$(window).trigger('resize');
});
@jimmy89Li
jimmy89Li / functions.php
Created March 29, 2017 14:38
Custom button with custom styles - WordPress editor
<?php
// Add custom button for styles
function customStylesButton($buttons) {
array_unshift($buttons, 'styleselect');
return $buttons;
}
add_filter('mce_buttons_2', 'customStylesButton');
//Add custom styles to the WordPress editor
function my_custom_styles( $init_array ) {
<!--HTML-->
<div class="header">
<div class="headerBg"></div>
</div>
<!--STYLE-->
<style>
.headerBg {
background-image: url(../img/headerBg.png);