Skip to content

Instantly share code, notes, and snippets.

View palmiak's full-sized avatar
😎
Working

Maciek Palmowski palmiak

😎
Working
View GitHub Profile
@palmiak
palmiak / force-plugin-activation.php
Last active November 5, 2020 15:12 — forked from jbrinley/force-plugin-activation.php
An mu-plugin that forces selected plugins to be active, without the capability to deactivate.
<?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/
*/
{#
Title: Owl link
Description: Link block
Category: formatting
Icon: admin-comments
Keywords: link links
Mode: edit
Align: left
PostTypes: page post
SupportsAlign: left right
{#
/**
* Block Name: Testimonial
*
* This is the template that displays the testimonial block.
*/
#}
<blockquote id="testimonial-{{ block.id }}" class="testimonial">
{{ fields.testimonial }}
<?php
function my_acf_block_render_callback( $block ) {
$vars['block'] = $block;
$vars['fields'] = get_fields();
Timber::render( '/template-parts/block/content-testimonial.twig', $vars );
}
<?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',
<?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;
<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>';
# Application
web/app/uploads/*
!web/app/uploads/.gitkeep
# WordPress
web/.htaccess
# Dotenv
.env.*
!.env.example
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
@palmiak
palmiak / bedrock_1
Last active November 22, 2017 18:18
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