Skip to content

Instantly share code, notes, and snippets.

😎
Working

Maciej Palmowski palmiak

😎
Working
Block or report user

Report or block palmiak

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
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
@palmiak
palmiak / .htaccess
Created Apr 18, 2017
Bedrock .htaccess for shared hosting
View .htaccess
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www.)?example.com$
RewriteCond %{REQUEST_URI} !^/web/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /web/$1
RewriteCond %{HTTP_HOST} ^(www.)?example.com$
RewriteRule ^(/)?$ index.php [L]
You can’t perform that action at this time.