Skip to content

Instantly share code, notes, and snippets.

@slavapas
slavapas / wp_child_theme.php
Last active January 6, 2021 13:13
Wordpress Child Theme
<?php
/*
Theme Name: Twenty Fifteen Child
Theme URI: http://example.com/twenty-fifteen-child/
Description: Twenty Fifteen Child Theme
Author: John Doe
Author URI: http://example.com
Template: twentyfifteen
Version: 1.0.0
License: GNU General Public License v2 or later
@slavapas
slavapas / functions.php
Created March 2, 2019 20:50
Adding support for WooCommerce 3.0’s new gallery feature to your theme
As you know we’ve redesigned the product gallery feature in WooCommerce to deliver a richer experience in 3.0.
This is a significant frontend change that can be broken down in to three separate new features;
Image zoom / magnification
Lightbox
Slider
To enable each of these features in your theme you must declare support using add_theme_support() like so;
add_action( 'after_setup_theme', 'yourtheme_setup' );
@slavapas
slavapas / search icon transform in search box.html
Created March 27, 2019 20:16
search icon transform in search box.html
<div class="searchBox">
<input type="text" class="searchInput" placeholder="Search">
<div class="searchHandle"></div>
</div>
-----------------
*{
box-sizing: border-box;
}
@slavapas
slavapas / functions.php
Last active January 6, 2021 13:33
function.php
<?php
function my_styles_scripts_method(){
// load main style.css
wp_enqueue_style('main_style', get_stylesheet_uri());
//load aditional css file
wp_enqueue_style('default_style', get_template_directory_uri().'/assets/css/default.css');
wp_enqueue_style('layout_style', get_template_directory_uri().'/assets/css/layout.css');
wp_enqueue_style('media_queries_style', get_template_directory_uri().'/assets/css/media-queries.css');
// load scripts
@slavapas
slavapas / index.html
Created August 20, 2020 21:12 — forked from d3noob/index.html
leaflet.js map with marker options
<!DOCTYPE html>
<html>
<head>
<title>Marker Leaflet Map</title>
<meta charset="utf-8" />
<link
rel="stylesheet"
href="http://cdn.leafletjs.com/leaflet-0.7/leaflet.css"
/>
</head>
@slavapas
slavapas / Custom Post Types
Created October 5, 2020 20:17
Define and post Custom Post Type #Wordpress
<?php
// Register Custom Post Type in functions.php
add_action( 'pre_get_posts', 'add_my_post_types_to_query' );
function add_my_post_types_to_query( $query ) {
if ( is_home() && $query->is_main_query() )
$query->set( 'post_type', array( 'post', 'movies' ) );
return $query;
}
@slavapas
slavapas / .gitignore
Created October 14, 2020 19:04
.gitignore for GIT in WordPress
/*
!wp-content/
.*
!.gitignore
!readme.md
~*
@slavapas
slavapas / functions.php
Last active May 25, 2021 12:04
ACF functions.php and index.php how to call them
<?php
// in functions.php create the CUSTOM POST TYPE
// create CPT = reviews
add_action('init', 'my_first_post_type');
function my_first_post_type()
{
// for thumbnails to be recognised
add_theme_support('post-thumbnails');
// CPT reviews
register_post_type('reviews', [
@slavapas
slavapas / hide-element-untill-page-loaded.js
Created November 4, 2020 21:22
hide HTML element untill page loaded using jQuery
// ------------------------------------
// Hide the element untill page loaded
// ------------------------------------
// HTML
<div id="my-modals" class="hide">
// CSS
.hide {
dislplay:none;
@slavapas
slavapas / front-page.php
Created December 29, 2020 16:49 — forked from codigoconjuan/front-page.php
Bootstrap 4 Slider with WordPress
<div id="main-slider" class="carousel slide mt-4" data-ride="carousel">
<?php $args = array(
'posts_per_page' => 5,
'tag' => 'slider'
);
$slider = new WP_Query($args);
if($slider->have_posts()):
$count = $slider->found_posts;
?>