Skip to content

Instantly share code, notes, and snippets.

View biuroreklama's full-sized avatar
🏠
Working from home

Biuro "Reklama" biuroreklama

🏠
Working from home
View GitHub Profile
@biuroreklama
biuroreklama / gutenberg.txt
Created August 3, 2019 22:39 — forked from chrismccoy/gutenberg.txt
Gutenberg Resources
Extending Gutenberg With SlotFill and Filters
https://10up.com/blog/2019/extending-gutenberg-with-slotfill/
Add a custom sidebar panel to Gutenberg
https://richardtape.com/2018/10/05/add-a-custom-sidebar-panel-to-gutenberg/
How to create a custom block for gutenberg
https://organicthemes.com/create-custom-block-wordpress-gutenberg/
Writing a wrapper block for Gutenberg in WordPress
/*
* Replace all SVG images with inline SVG
*/
jQuery('img.svg').each(function(){
var $img = jQuery(this);
var imgID = $img.attr('id');
var imgClass = $img.attr('class');
var imgURL = $img.attr('src');
jQuery.get(imgURL, function(data) {
@biuroreklama
biuroreklama / pagination.php
Created September 21, 2018 12:13 — forked from franz-josef-kaiser/pagination.php
WordPress pretty Pagination with first/last, next/prev and range parameters above/below current page
- MOVED -
Can now be found in a repository incl. license, readme, styles and plugin php file: https://github.com/franz-josef-kaiser/Easy-Pagination-Deamon
@biuroreklama
biuroreklama / page.php
Created May 11, 2018 09:06
Pętla cennikowa - wywołowane w pętli strony wp, których nadrzędną stroną jest strona o id=2
<?php $args = array(
'parent' => 2,
'post_type' => 'page',
'post_status' => 'publish'
);
$pricePages = get_pages($args);
foreach ($pricePages as $pricePage) {
$html = "<div class='price__table price__table--".$pricePage->post_name."' id='".$pricePage->post_name."'>";
$html = $html."<div class='price__thead'>";
@biuroreklama
biuroreklama / header.php
Created April 5, 2018 14:15
Twentysixteen and Bootstrap 4 Menu without broken styles
<?php if ( has_nav_menu( 'primary' ) ) : ?>
<button id="menu-toggle" class="menu-toggle" type="button" data-toggle="collapse" data-target="#navbarNavAltMarkup" aria-controls="navbarNavAltMarkup" aria-expanded="false" aria-label="Toggle navigation"><?php _e( '<i class="fa fa-bars fa-2x"></i>', 'wyspanasion' ); ?></button>
<div id="site-header-menu" class="site-header-menu">
<?php if ( has_nav_menu( 'primary' ) ) : ?>
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<div class="collapse navbar-collapse" id="navbarNavAltMarkup">
<div class="navbar-nav">
<li class="nav-item active">
<a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a>
@biuroreklama
biuroreklama / style.css
Created February 6, 2018 15:13
Mega menu wp boostrap absolute full width
.open > .dropdown-menu {
background-color: #fff;
display: block;
height: auto;
position: fixed;
top: 35px;
width: 100vw;
left: 0px;
}
@biuroreklama
biuroreklama / functions
Created February 6, 2018 13:08
ACF and Orphans plugin
function acf_orphans($value, $post_id, $field) {
if ( class_exists( 'iworks_orphan' ) ) {
$orphan = new \iworks_orphan();
$value = $orphan->replace( $value );
}
return $value;
}
add_filter('acf/format_value/type=textarea', 'acf_orphans', 10, 3);
add_filter('acf/format_value/type=wysiwyg', 'acf_orphans', 10, 3);
<?php
$part_category = get_sub_field('kategoria_id'); // This HAS to be a string value. Make sure that it's not an array or term object.
$args = array(
'post_type' => 'post',
'posts_per_page' => 1, //fetches ALL posts without limit
'order' => 'ASC',
'tax_query' => array(
array(
'taxonomy' => 'category', // If you're using a custom taxonomy this needs to be changed
'terms' => array($part_category[0]),
@biuroreklama
biuroreklama / functions.php
Created January 2, 2018 19:22
Stylowanie adresu w Woocommerce
add_filter( 'woocommerce_localisation_address_formats', 'woocommerce_custom_address_format', 20 );
function woocommerce_custom_address_format( $formats ) {
$formats[ 'US' ] = "{company}\n{name}\n{address_1}\n{address_2}\n{city}, {state_code} {postcode}\n{country}";
return $formats;
}
@biuroreklama
biuroreklama / functions.php
Last active December 1, 2017 09:27
Dla sposobu wysyłki ukrywanie sposobu płatności - (przez value: flexible_s... i bacs - dotyczy płatności przelewem
<?php
function my_custom_available_payment_gateways( $gateways ) {
$chosen_shipping_rates = WC()->session->get( 'chosen_shipping_methods' );
// When 'local delivery' has been chosen as shipping rate
if ( in_array( 'flexible_shipping_10_2', $chosen_shipping_rates ) ) :
// Remove bank transfer payment gateway
unset( $gateways['bacs'] );
endif;
return $gateways;