Skip to content

Instantly share code, notes, and snippets.

View apsolut's full-sized avatar
🎯
Focusing

Aleksandar Perisic apsolut

🎯
Focusing
View GitHub Profile
@apsolut
apsolut / remove-remove_wp_menus.php
Created July 21, 2016 09:29
Remove WordPress Menus v1
#https://codex.wordpress.org/Function_Reference/remove_menu_page
#https://codex.wordpress.org/remove_node
#https://codex.wordpress.org/Function_Reference/remove_menu
#https://codex.wordpress.org/Class_Reference/WP_Admin_Bar
/* remove menu page */
add_action( 'admin_menu', 'remove_menus' );
function remove_menus(){
remove_menu_page( 'index.php' ); //Dashboard
@apsolut
apsolut / get_image_div_class_each.js
Created July 30, 2016 17:24
get_image_div_class_each
var getallimages = '';
var Icons = {};
jQuery('#voc_fullstage_img #voc_ext_pics').find('.voc_Stage').each(function(index) {
var text = jQuery(this).find('img').attr('src');
if (text.indexOf('(alias)') === -1) {
Icons[text.trim()] = text.trim().split('-').join(' ');
}
});
var keys = Object.keys(Icons),
@apsolut
apsolut / onepage-url-extract-only-href-from-li-element.js
Last active October 6, 2016 12:58
onepage website with working url-s
jQuery(document).ready(function () {
var clickHandler = ('ontouchstart' in document.documentElement ? "touchstart" : "click");
jQuery("#menu-mainmenu li a:not(.ignore)").bind(clickHandler, function(e) {
// link - substring will take only "#name" - and you can add link with "/#name"
// so it can work on onepage site that have blog.
var link = jQuery(this).attr('href').substring(jQuery(this).attr('href').indexOf('#'))
// this will take link and calculate top offset
var posi = jQuery(link).offset().top;
@apsolut
apsolut / php-switch-statement-simple.php
Created January 24, 2017 11:37
PHP Switch statement..
<?php
switch(TRUE){
case email_is_valid($email):
// Do something.
break;
case username_is_valid($user):
// Do stuff.
break;
case pass_too_short($pass) && pass_not_save($pass):
// Other stuff.
@apsolut
apsolut / dc_create_start_pages.php
Created February 3, 2017 08:45
Create pages from plugin - easy one
<?php
/*
* Plugin Name: Easy Create Page from plugin
* Description: Delete and Add - pages, posts
* Version: 0.0.1
*
* https://developer.wordpress.org/reference/functions/wp_delete_post/
*/
defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
@apsolut
apsolut / sql-queries-wordpress.sql
Created March 29, 2017 08:51
Useful SQL Queries
/* Source: https://codex.wordpress.org/Changing_The_Site_URL */
/* WordPress Address (URL) & Site Address (URL) */
UPDATE wp_options SET option_value = replace(option_value, 'http://www.old-domain.com', 'http://www.new-domain.com') WHERE option_name = 'home' OR option_name = 'siteurl';
/* wp_post */
UPDATE wp_posts SET post_content = replace(post_content, 'http://www.old-domain.com', 'http://www.new-domain.com');
@apsolut
apsolut / acf-show-form-on-post.css
Last active March 31, 2017 11:53
closed contact form on post page - show only button (toggle form)
/*---------- Post form ----------*/
.job-contact-form {
@include span-columns(24);
@include omega();
@include row();
margin-top: $np;
padding-top: $np;
margin-bottom: $np;
padding-bottom: $np;
border-top: 1px solid lighten($gray, 60%);
@apsolut
apsolut / acf-slider-for-page-and-categories.php
Last active March 31, 2017 17:53
ACF slider for Pages & Categories
<div class="mls-slider-wrapper no-print">
<?php
global $wp_query;
$term_id = null;
$taxonomy = null;
$queried_object = get_queried_object();
if ( ( ! $queried_object == null ) && ! is_search() && ! is_404() ) {
$taxonomy = $queried_object->taxonomy;
@apsolut
apsolut / repeater-field-show-more-button.php
Last active April 10, 2017 14:53
acf repeater show more (load more) button with js
<?php
/**
* Download
* Elements
*
* @package THEMENAME
*/
$fullwidth = get_sub_field('fullwidth');
$center = get_sub_field('center');
$special = get_sub_field('special');
@apsolut
apsolut / styles.css
Created April 14, 2017 18:26 — forked from pburtchaell/styles.css
VH and VW units can cause issues on iOS devices. To overcome this, create media queries that target the width, height, and orientation of iOS devices.
/**
* VH and VW units can cause issues on iOS devices: http://caniuse.com/#feat=viewport-units
*
* To overcome this, create media queries that target the width, height, and orientation of iOS devices.
* It isn't optimal, but there is really no other way to solve the problem. In this example, I am fixing
* the height of element `.foo` —which is a full width and height cover image.
*
* iOS Resolution Quick Reference: http://www.iosres.com/
*/