Skip to content

Instantly share code, notes, and snippets.

View wolfcoder's full-sized avatar
💭
Full Stack Developer

bams wolfcoder

💭
Full Stack Developer
View GitHub Profile
@wolfcoder
wolfcoder / .htaccess
Created November 24, 2017 13:26 — forked from Zodiac1978/.htaccess
Make your Website faster - a safe htaccess way
#
# Sources:
# http://stackoverflow.com/questions/7704624/how-can-i-use-gzip-compression-for-css-and-js-files-on-my-websites
# http://codex.wordpress.org/Output_Compression
# http://www.perun.net/2009/06/06/wordpress-websites-beschleuinigen-4-ein-zwischenergebnis/#comment-61086
# http://www.smashingmagazine.com/smashing-book-1/performance-optimization-for-websites-part-2-of-2/
# http://gtmetrix.com/configure-entity-tags-etags.html
# http://de.slideshare.net/walterebert/die-htaccessrichtignutzenwchh2014
# http://de.slideshare.net/walterebert/mehr-performance-fr-wordpress
#
INITIALISATION
==============
load wp-config.php
set up default constants
load wp-content/advanced-cache.php if it exists
load wp-content/db.php if it exists
connect to mysql, select db
load object cache (object-cache.php if it exists, or wp-include/cache.php if not)
load wp-content/sunrise.php if it exists (multisite only)
@wolfcoder
wolfcoder / video-tag embed.html
Created June 16, 2021 04:44
add video embed tag html
<!-- custom ad video-->
<div id="video-ads-insert" class="position-absolute bg-primary" >
<div style="display: none" id="ad-will-end" class="position-absolute">This ad will end in <span id="counter-duration">24</span>s</div>
<div style="display: none" id="skip-ad" class="position-absolute p-2 border rounded" >
Skip ad in <span id="counter-limit">5</span>s</div>
<div id="play-ad" class="position-absolute p-2 " >
<i class="fa fa-play" aria-hidden="true"></i>
</div>
<video id="wayang-ad" controls class="w-100 h-100" style="width: inherit; height: inherit">
@wolfcoder
wolfcoder / video-ads.js
Created June 16, 2021 05:50
script js for controling behavior
jQuery(document).ready(function () {
jQuery('#play-ad').click(
function () {
jQuery('#play-ad').remove();
jQuery('#ad-will-end, #skip-ad').show();
let adLimit = 5;
let adDuration = 24;
document.getElementById('wayang-ad').play();
@wolfcoder
wolfcoder / video-ads.css
Created June 16, 2021 05:52
style for video ads
#video-ads-insert {
width: 100%;
height: 100%;
position: absolute;
z-index: 1000;
color: #FFF;
background: #FFF;
text-align: center
}
wp_localize_script('wptail', 'wpenginerData', array(
'root_url' => get_site_url(),
'nonce' => wp_create_nonce('wp_rest')
));
function wpenginer_custom_rest(){
register_rest_field('post', 'authorName', array(
'get_callback' => function() {return get_the_author();}
));
}
add_action('rest_api_init', 'wpenginer_custom_rest');
<?php
/*
Plugin Name: Our Plugin Menu
Description: Adding Sub menu in admin
Version: 1.0
Author: Bam
Author URI: https://wpenginer.com
*/
if ( ! defined( 'ABSPATH' ) ) {
<?php
/*
Plugin Name: Rentalist
Description: Create a plugin with sub menu and script.js jquery included with ajax admin
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
<?php
class RT_Settings {
function __construct() {
add_action( "rentalist_save_settings", array( $this, "rentalist_save_settings_func" ), 10, 1 );
}
function rentalist_save_settings_func( $params = array() ) {
if ( isset( $params['rentalist_setting'] ) && $params['rentalist_setting'] != '' ) {