Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion env-sample
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ MYSQL_DATABASE=wordpress
# Only first build
WP_ROOT=/var/www/html
WP_URL=http://localhost
WP_VERSION=4.8.2
WP_VERSION=4.9.5
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change should be made on different PR since they are completely unrelated.

WP_DB_PREFIX=wp_
WP_ADMIN_USER=root
WP_ADMIN_PASSWORD=root
Expand Down
58 changes: 58 additions & 0 deletions wp/wp-content/themes/sampletheme/functions/acf.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<?php

class AcfCustomJsonData
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The classname should be more clear to tell it's responsibility.

{
private static $acf_custom_json_data;

private static $theme_path = '/inc/acf-json';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

theme_path seems like pointing to the path of the theme itself.


private function __construct()
{
}

public static function get_json_data_path($default_path)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should not have such a global access modifier.

Please make it private along with moving my_acf_json_save_point and other functions into this class.

{
$path = get_stylesheet_directory() . self::$theme_path;
if (!file_exists($path)) mkdir($path);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mkdir should be run recursively using third param arg.

return $path;
}
}

/**
* acf設定を保存
* 2018.05.12
* author:ryota moiryama
*/
function my_acf_json_save_point($path)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not enclosing this into AcfCustomJsonData class?

{
return AcfCustomJsonData::get_json_data_path($path);
}
//add_filter('acf/settings/save_json', 'my_acf_json_save_point');

/**
* acf設定を呼び出し
* 2018.05.12
* author:ryota moiryama
*/
function my_acf_json_load_point($paths)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here

{
return array(AcfCustomJsonData::get_json_data_path($paths));
}
//add_filter('acf/settings/load_json', 'my_acf_json_load_point');

/**
* ダッシュボードにオプションページを設置
* 2018.05.12
* author:ryota moiryama
*/
function display_acf_option_page()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here

{
if (function_exists('acf_add_options_page')) {
acf_add_options_page(array(
'page_title' => "OPTION",
'menu_title' => "OPTION",
'menu_slug' => 'acf-options',
));
}
}
//add_action('init','display_acf_option_page');