Skip to content

Commit

Permalink
Merge pull request #5 from jabranr/wp-5-5-compatibility
Browse files Browse the repository at this point in the history
WP 5.5 compatibility
  • Loading branch information
jabranr authored Aug 18, 2020
2 parents dee1c9a + 853bd62 commit 95f31b0
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 7 deletions.
7 changes: 7 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM wordpress:5.5

COPY ./entrypoint.sh /usr/local/bin/apache2-custom.sh
RUN chmod 755 /usr/local/bin/apache2-custom.sh
RUN chmod +x /usr/local/bin/apache2-custom.sh

CMD [ "apache2-custom.sh" ]
6 changes: 4 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
version: "3.1"
version: "3.2"

services:
wordpress:
image: wordpress
build: .
restart: always
container_name: wordpress
ports:
- 8080:80
environment:
Expand All @@ -20,6 +21,7 @@ services:
db:
image: mysql:5.7
restart: always
container_name: mysql
environment:
MYSQL_DATABASE: exampledb
MYSQL_USER: exampleuser
Expand Down
30 changes: 30 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/usr/bin/env bash

cd /var/www/html

WPPATH=/var/www/html

echo "- Fix permissions";
echo "=====================================";
chown -R www-data:www-data $WPPATH

echo "- Install WP CLI";
echo "=====================================";
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
php $WPPATH/wp-cli.phar --info
chmod +x wp-cli.phar
mv $WPPATH/wp-cli.phar /usr/local/bin/wp

echo "- Install and activate required plugins";
echo "=====================================";
wp plugin install advanced-custom-fields --activate --path=$WPPATH --allow-root
wp plugin install acf-to-rest-api --activate --path=$WPPATH --allow-root
wp plugin activate nullify-empty-fields-for-acf --path=$WPPATH --allow-root

echo "- Add a development user";
echo "=====================================";
wp user create dev [email protected] --role=administrator --user_pass=password --path=$WPPATH --allow-root

echo "- Start apache";
echo "=====================================";
exec "apache2-foreground"
6 changes: 3 additions & 3 deletions src/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Plugin URI: https://github.com/jabranr/nullify-empty-fields-for-acf
* Description: Set Advanced Custom Fields (ACF) empty field value as <code>null</code> instead of <code>false</code> to avoid GraphQL error in GatsbyJS.
* Author: Jabran Rafique <[email protected]>
* Version: 1.1.0
* Version: 1.2.0
* Author URI: https://jabran.me?utm_source=nullify-empty-fields-for-acf
* License: MIT License
*
Expand Down Expand Up @@ -85,9 +85,9 @@ function nullify_empty_fields_for_acf_toggle($remove = false) {

foreach($nullifyTypes as $nullifyType) {
if ($remove) {
remove_filter('acf/format_value/type=' . $nullifyType, 'nullify_empty_fields_for_acf_empty', 100, 3);
remove_filter('acf/format_value/type=' . trim($nullifyType), 'nullify_empty_fields_for_acf_empty', 100, 3);
} else {
add_filter('acf/format_value/type=' . $nullifyType, 'nullify_empty_fields_for_acf_empty', 100, 3);
add_filter('acf/format_value/type=' . trim($nullifyType), 'nullify_empty_fields_for_acf_empty', 100, 3);
}
}
}
Expand Down
8 changes: 6 additions & 2 deletions src/readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ Contributors: jabranr
Donate link: https://paypal.me/jabranr
Tags: gatsby, graphql, acf, advanced-custom-fields, wordpress
Requires at least: 5.0
Tested up to: 5.3.2
Stable tag: 1.1.0
Tested up to: 5.5
Stable tag: 1.2.0
Requires PHP: 7.1
License: MIT License
License URI: https://opensource.org/licenses/MIT
Expand All @@ -27,6 +27,10 @@ Set Advanced Custom Fields (ACF) empty field value as `null` instead of `false`

== Changelog ==

= 1.2.0 =
* Compatibility for WordPress 5.5
* Bugfix where default value was not being applied to all ACF field types

= 1.1.0 =
* Support for Advanced Custom Fields (PRO)

Expand Down

0 comments on commit 95f31b0

Please sign in to comment.