Skip to content

Instantly share code, notes, and snippets.

View Trovin's full-sized avatar
🌴

Ruslan Kulyhin Trovin

🌴
View GitHub Profile
@Trovin
Trovin / Angular - simple dynamic reactive form
Last active June 18, 2020 19:29
Angular - simple dynamic reactive form
INPUT DATA TO FORM
import { Validators } from '@angular/forms';
export class InputData {
field: string;
icon: string;
validation: Validators[];
errorMessage: string;
@Trovin
Trovin / Remote db instruction
Created September 25, 2019 12:31
Remote db instruction
1) Add to local site 2 files | wp-config.php | wp-config-local.php
2) Change in wp-config-local.php to your test | define('DB_NAME', 'test7.f5-cloud.top');
3) Change in wp-config.php db prefix
4) Change project folder name to test domain, example "test5.f5.cloud.top";
@Trovin
Trovin / Add on start new project
Created September 13, 2019 15:21
Add on start new project
img {
max-width: 100%;
height: auto;
vertical-align: middle;
outline: none;
user-select: none;
&:hover, &:focus {
outline: none;
user-select: none;
@Trovin
Trovin / WP display custom tax,related category post,besides current
Last active July 31, 2019 14:44
WP display custom tax,related category post,besides current
<div class="single-trip__footer">
<div class="page-container">
<?php
$id = get_the_ID();
$terms = get_the_terms( $id, 'stories-category' );
foreach($terms as $term) {
$term_id = $term->term_id;
}
$args = array(
@Trovin
Trovin / Wp filter custom post+custom tax, by category id + load more
Last active September 27, 2019 10:20
Wp filter custom post+custom tax, by category id + load more
DON'T FORGET **
- change to your value $image, setPostType(), html response tpl, html classes
- hide by deffault in css 'page-stories__item'
IN YOUR TEMPLATE
================
<!-- get all custom taxonomy categories -->
<div class="stories-category__wrapper">
@Trovin
Trovin / ACF hide all field by default
Last active July 31, 2019 14:51
ACF hide all field by default
/**
* Hide all ACF field by default
*/
add_action('acf/input/admin_head', 'my_acf_input_admin_head');
function my_acf_input_admin_head() { ?>
<script type="text/javascript">
jQuery(function(){
jQuery('.acf-postbox').addClass('closed');
});
</script>
@Trovin
Trovin / Wp add description to Featured image box
Last active August 6, 2019 11:40
Wp add description to Featured image box
@Trovin
Trovin / WP + ACF hero section with background select -img -video file -youtube -vimeo
Last active November 23, 2024 10:12
WP + ACF hero section with background select -img -video file -youtube -vimeo
PHP
===
<!-- section-hero -->
<?php
$select_value = get_field('hero_section_background_setting');
$opacity = get_field('hero_section_shadow_gradient_opacity');
if($opacity < 0 || $opacity == NULL) {
$opacity = 0.75;
}
@Trovin
Trovin / PHP - WP youtube and vimeo generated src and settings, need change url to your value
Last active July 31, 2019 14:49
PHP - WP youtube and vimeo generated src and settings, need change url to your value
//youtube
<?php
$url = 'https://www.youtube.com/embed/5DEdR5lqnDE'; //change url
$list_id = array_pop(explode('/', $url));
$autoplay = '?autoplay=1';
$controls = '&controls=0';
$loop = '&loop=1';
$rel = '&rel=0';
$mute = '&mute=1';
$playlist = '&playlist='.$list_id.'';
@Trovin
Trovin / LIB-JS animate on scroll
Last active July 31, 2019 14:52
LIB-JS animate on scroll
https://michalsnik.github.io/aos/