Skip to content

Instantly share code, notes, and snippets.

View freezvd's full-sized avatar

Valentin Zmaranda freezvd

  • Bucharest, Romania
View GitHub Profile
@freezvd
freezvd / add-wordpress-settings-page.php
Created April 25, 2018 09:38 — forked from DavidWells/add-wordpress-settings-page.php
WordPress :: Add Settings Page with All Fields
<?php
/*
Plugin Name: Homepage Settings for BigBang
Plugin URI: http://www.inboundnow.com/
Description: Adds additional functionality to the big bang theme.
Author: David Wells
Author URI: http://www.inboundnow.com
*/
// Specify Hooks/Filters
var BrowserDetect = {
init: function () {
this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
this.version = this.searchVersion(navigator.userAgent)
|| this.searchVersion(navigator.appVersion)
|| "an unknown version";
this.OS = this.searchString(this.dataOS) || "an unknown OS";
this.isApproved = this.searchList(this.browser, this.version);
if(this.OS == "iPad")document.documentElement.className += ' iOS';
@freezvd
freezvd / plugin.js
Created October 18, 2017 10:19
JavaScript: jQuery plugin boilerplate by Stefan Gabos #snippet
// jQuery Plugin Boilerplate
// A boilerplate for jumpstarting jQuery plugins development
// version 1.1, May 14th, 2011
// by Stefan Gabos
(function($) {
$.pluginName = function(element, options) {
var plugin = this;
plugin.settings = {}
@freezvd
freezvd / acf-missing.php
Created September 21, 2017 08:05 — forked from thierrypigot/acf-missing.php
WordPress mu plugins to check if "Advanced Custom Fields Pro" is active.
<?php
if( !class_exists('acf') )
{
$tp_acf_notice_msg = __( 'This website needs "Advanced Custom Fields Pro" to run. Please download and activate it', 'tp-notice-acf' );
/*
* Admin notice
*/
add_action( 'admin_notices', 'tp_notice_missing_acf' );
function tp_notice_missing_acf()
@freezvd
freezvd / isIE.js
Created September 20, 2017 12:11 — forked from gaboratorium/isIE.js
Detect IE with JavaScript #ie #edge #js #javascript
// Forked from https://codepen.io/gapcode/pen/vEJNZN
// Get IE or Edge browser version
var version = detectIE();
if (version === false) {
document.getElementById('result').innerHTML = '<s>IE/Edge</s>';
} else if (version >= 12) {
document.getElementById('result').innerHTML = 'Edge ' + version;
} else {
@freezvd
freezvd / wp_insert_post.php
Created May 3, 2017 11:35 — forked from Zenger/wp_insert_post.php
wp_insert_post and WPML
<?php
global $wpdb;
// Insert the original post
$original = wp_insert_post($array, true);
// Insert the translated post
$translated = wp_insert_post($array, true);
// Make some updates to both translations
@freezvd
freezvd / MailPoet: Redirect After Submit
Created February 19, 2016 09:35 — forked from RafaelFunchal/MailPoet: Redirect After Submit
Redirects to a custom link after submits the subscription form
<script>
(function($){
$(document).ready(function(){
$( 'form.widget_wysija' ).submit(function(e){
e.preventDefault();
setTimeout(function() {
var msg = $( '.wysija-msg' );
if( msg.text() !== '' ){
window.location.replace( 'http://your_thank_you_page_url' );
}
@freezvd
freezvd / combine-menus.php
Created February 16, 2016 12:44 — forked from devinsays/combine-menus.php
Combines two WordPress menus into one.
<?php
/**
* Combines the markup of two menu areas into one.
*/
// Get the markup list items in the first menu.
$menu = wp_nav_menu( array(
'theme_location'=> 'menu-1',
'fallback_cb' => false,
'container' => '',
@freezvd
freezvd / customizer-controls-40
Created February 11, 2016 09:30 — forked from devinsays/customizer-controls-40
WordPress 4.0 Customizer Controls
function prefix_customizer_register( $wp_customize ) {
$wp_customize->add_panel( 'panel_id', array(
'priority' => 10,
'capability' => 'edit_theme_options',
'theme_supports' => '',
'title' => __( 'Example Panel', 'textdomain' ),
'description' => __( 'Description of what this panel does.', 'textdomain' ),
) );
@freezvd
freezvd / wp-query-ref.php
Created January 28, 2016 12:13 — forked from luetkemj/wp-query-ref.php
WP: Query $args
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.com
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query#Parameters
* Source: https://core.trac.wordpress.org/browser/tags/3.9/src/wp-includes/query.php
*/
$args = array(