Skip to content

Instantly share code, notes, and snippets.

Avatar
😎
Working

Maciej Palmowski palmiak

😎
Working
View GitHub Profile
@palmiak
palmiak / force-plugin-activation.php
Last active Nov 5, 2020 — forked from jbrinley/force-plugin-activation.php
An mu-plugin that forces selected plugins to be active, without the capability to deactivate.
View force-plugin-activation.php
<?php
/*
Plugin Name: Force Plugin Activation/Deactivation (except if WP_DEBUG is on)
Plugin URI: http://tri.be/
Description: Make sure the required plugins are always active.
Version: 1.0
Author: Modern Tribe, Inc.
Author URI: http://tri.be/
*/
View simple-acf-block.twig
{#
Title: Owl link
Description: Link block
Category: formatting
Icon: admin-comments
Keywords: link links
Mode: edit
Align: left
PostTypes: page post
SupportsAlign: left right
View acf_gutenberg_3.twig
{#
/**
* Block Name: Testimonial
*
* This is the template that displays the testimonial block.
*/
#}
<blockquote id="testimonial-{{ block.id }}" class="testimonial">
{{ fields.testimonial }}
View acf_gutenberg_2.php
<?php
function my_acf_block_render_callback( $block ) {
$vars['block'] = $block;
$vars['fields'] = get_fields();
Timber::render( '/template-parts/block/content-testimonial.twig', $vars );
}
View acf_gutenber_1.php
<?php
add_action('acf/init', 'my_acf_init');
function my_acf_init() {
// sprawdzamy czy funkcja istnieje
if( function_exists('acf_register_block') ) {
// rejestrujemy blok
acf_register_block(array(
'name' => 'testimonial',
View remove_unused_shortcodes.php
<?php
add_filter( 'the_content', 'strip_usless_shortcodes', 50 );
function strip_usless_shortcodes( $content ) {
preg_match_all( '@\[([^<>&/\[\]\x00-\x20=]++)@', $content, $matches );
$pattern = get_shortcode_regex( $matches[1] );
$content = preg_replace_callback( "/$pattern/", 'strip_usless_shortcodes_callback', $content );
$content = str_replace( '<p></p>', '', $content );
return $content;
View timber_1.php
<div class="wrapper">
<?php
$args = [ 'posts_per_page' => 3, 'post_type' => 'post' ];
$posts = get_posts( $args );
if ( $posts ) {
echo '<div id="posts">';
foreach( $wpisy as $post ) {
$post = setup_postdata();
echo '<p><a href="'. get_the_permalink().'">'.get_the_title().'</a></p>';
View bedrock_3
# Application
web/app/uploads/*
!web/app/uploads/.gitkeep
# WordPress
web/.htaccess
# Dotenv
.env.*
!.env.example
View bedrock_2
echo DB_NAME=${db_name} > .env
echo DB_USER=${dev_db_user} >> .env
echo DB_PASSWORD=${dev_db_password} >> .env
echo DB_HOST=${dev_db_host} >> .env
echo DB_PREFIX=${db_prefix} >> .env
echo WP_ENV=${wp_env} >> .env
echo WP_HOME=http:\/\/domena.pl >> .env
echo WP_SITEURL=http:\/\/domena.pl/wp >> .env
echo "AUTH_KEY=''" >> .env
View bedrock_1
echo DB_NAME=${db_name} > .env
echo DB_USER=${dev_db_user} >> .env
echo DB_PASSWORD=${dev_db_password} >> .env
echo DB_HOST=${dev_db_host} >> .env
echo DB_PREFIX=${db_prefix} >> .env
echo WP_ENV=${wp_env} >> .env
echo WP_HOME=http:\/\/${folder}.domena.pl >> .env
echo WP_SITEURL=http:\/\/${folder}.domena.pl/wp >> .env
echo "AUTH_KEY=''" >> .env