Skip to content

Instantly share code, notes, and snippets.

View ihorduchenko's full-sized avatar
💭
Working

Ihor Duchenko ihorduchenko

💭
Working
View GitHub Profile
@ihorduchenko
ihorduchenko / Stylesheets using Javascript
Created January 18, 2017 21:02
Load stylesheets using Javascript
<!-- Load CSS -->
<script>
function loadCSS(hf) {
var ms = document.createElement("link");
ms.rel = "stylesheet";
ms.href = hf;
document.getElementsByTagName("head")[0].appendChild(ms);
}
loadCSS("css/fonts.css"); //User Styles: Fonts
loadCSS("css/style.css"); //User Styles: Main
<?php if( have_rows('slider') ): ?>
<?php while( have_rows('slider') ): the_row();
// vars
$image = get_sub_field('image');
$heading = get_sub_field('heading');
$disclaimer = get_sub_field('title');
?>
<div class="tables">
<div class="tables-col ac">
<?php if ( have_posts() ) : query_posts( 'cat=4'); while (have_posts()) : the_post(); ?>
<div class="table <?php $tag = get_field('tag');
echo $tag?>">
<div class="swiper-container gallery-top">
<div class="swiper-wrapper">
<?php if (have_rows('imgs')): ?>
//insert this code after #END WordPress
<FilesMatch "^.*(error_log|wp-config\.php|php.ini|\.[hH][tT][aApP].*)$">
Order allow,deny
Deny from all
</FilesMatch>
OR
<Files wp-config.php>
@ihorduchenko
ihorduchenko / functions.php
Created April 1, 2017 13:21 — forked from agragregra/functions.php
WordPress functions.php Must Have
show_admin_bar(false);
add_theme_support('post-thumbnails');
remove_action( 'wp_head', 'feed_links_extra', 3 );
remove_action( 'wp_head', 'feed_links', 2 );
remove_action( 'wp_head', 'rsd_link' );
remove_action('wp_head', 'wlwmanifest_link');
remove_action('wp_head', 'wp_generator');
@ihorduchenko
ihorduchenko / jquery-active.js
Created April 1, 2017 13:27 — forked from agragregra/jquery-active.js
jQuery Active Menu
//Active menu
$("li a").each(function() {
if (this.href == window.location.href) {
$(this).addClass("active");
}
});
//destination file: functions.php
add_action('template_redirect', 'single_result');
function single_result() {
if (is_search()) {
global $wp_query;
if ($wp_query->post_count == 1) {
wp_redirect( get_permalink( $wp_query->posts['0']->ID ) );
}
}
}
@ihorduchenko
ihorduchenko / while-loop
Created April 25, 2017 08:36
Cross-browser loop using table
$query = new WP_Query( $args );
if ( $query->have_posts() ) { ?>
<table>
<?php $i = 0;
while( $query->have_posts() ) {
$query->the_post(); ?>
<?php if($i == 0){ echo "<tr>"; }?>
<td class="item_post_man">
<a href="<?php echo get_permalink(); ?>">
<?php if ( has_post_thumbnail() ) {
@ihorduchenko
ihorduchenko / Angular 2 email validation RegEx
Created July 6, 2017 16:31
Angular 2 email validation RegEx
Validators.pattern("[a-z0-9 !#$%&'*+/=&^_`{|}~-]+(?:\.[a-z0-9 !#$%&'*+/=&^_`{|}~-]+)*@(?: [a-z0-9-]*[a-z0-9-])?\.)+[a-z0-9-]*[a-z0-9-])?")
@ihorduchenko
ihorduchenko / Slide Up
Created July 31, 2017 11:33
SlideUp block from above parent
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<style>
.newresponse .services-board-wrapper {