torasan
フォーラムへの返信
-
フォーラム: プラグイン
返信が含まれるトピック: ソーシャル登録の前にユーザーに権限を選択させる方法フォーラム: プラグイン
返信が含まれるトピック: ソーシャル登録の前にユーザーに権限を選択させる方法色々やってみたのですが上手くいきません。
以下のコードと
<?php add_action('nsl_before_register', function ($provider) { /** @var $provider NextendSocialProvider */ /** * You must return true if you want to add custom fields */ add_filter('nsl_registration_require_extra_input', function ($askExtraData) { return true; }); add_filter('nsl_registration_validate_extra_input', function ($userData, $errors) { /** @var $errors WP_Error */ $isPost = isset($_POST['submit']); if ($isPost) { /** * You must add an error if your fields are not filled or does not fulfill your validation. * If no errors added, that means that the register form is fine. */ if (!empty($_POST['favorite_color']) && is_string($_POST['favorite_color'])) { $userData['favorite_color'] = $_POST['favorite_color']; } else { $userData['favorite_color'] = ''; $errors->add('favorite_color_missing', '<strong>' . __('ERROR') . '</strong>: Favorite Color can not be empty.', array('form-field' => 'favorite_color')); } } else { /** * Fill up user data with default values to prevent the notice in the form */ $userData['favorite_color'] = ''; } return $userData; }, 10, 2); /** You can use nsl_registration_form_start and nsl_registration_form_end action. */ add_action('nsl_registration_form_start', function ($userData) { ?> <p> <label for="favorite_color">Favorite Color<br/> <input type="text" name="favorite_color" id="favorite_color" class="input" value="<?php echo esc_attr(wp_unslash($userData['favorite_color'])); ?>" size="20"/></label> </p> <?php }); /** * $user_id contains the created user's id * $userData contains the previously validated input */ add_action('nsl_registration_store_extra_input', function ($user_id, $userData) { add_user_meta($user_id, 'favorite_color', $userData['favorite_color']); }, 10, 2); });
テーマで使用しているclass-woocommerce-registration.phpのコード(以下)を組み合わせてみたのですが、
<?php class Jobify_WooCommerce_Registration { public function __construct() { add_action( 'woocommerce_register_form', array( $this, 'register_form' ) ); add_filter( 'woocommerce_new_customer_data', array( $this, 'new_customer_data' ) ); } public function new_customer_data( $data ) { if ( ! isset( $_POST['reg_role'] ) ) { return $data; } $role = esc_attr( $_POST['reg_role'] ); $whitelist = $this->get_registration_roles(); if ( ! in_array( $role, array_keys( $whitelist ) ) ) { return $data; } $data['role'] = $role; return $data; } public function get_allowed_roles() { $roles = get_theme_mod( 'registration-roles', array( 'employer' ) ); if ( '' == $roles ) { return array(); } if ( ! is_array( $roles ) ) { $roles = explode( ',', $roles ); } $roles = array_map( 'trim', $roles ); return $roles; } private function get_editable_roles() { global $wp_roles; $all_roles = $wp_roles->roles; $editable_roles = apply_filters( 'editable_roles', $all_roles ); return $editable_roles; } public function get_registration_roles() { add_filter( 'editable_roles', array( $this, 'editable_roles' ) ); $roles = $this->get_editable_roles(); if ( empty( $roles ) ) { return array(); } $value = array_keys( $roles ); $labels = wp_list_pluck( $roles, 'name' ); $options = array_combine( $value, $labels ); remove_filter( 'editable_roles', array( $this, 'editable_roles' ) ); return $options; } public function editable_roles( $roles ) { $remove = apply_filters( 'jobify_removed_roles', array( 'administrator', 'editor', 'author', 'contributor', 'shop_manager' ) ); foreach ( $remove as $role ) { unset( $roles[ $role ] ); } return $roles; } public function register_form() { $default = get_theme_mod( 'registration-default', array( 'employer' ) ); $roles = $this->get_allowed_roles(); $labels = $this->get_registration_roles(); if ( empty( $roles ) ) { return; } if ( 1 == count( $roles ) ) { echo '<input type="hidden" value="' . esc_attr( $roles[0] ) . '" name="reg_role" />'; return; } $options = array(); foreach ( $roles as $value ) { // in case things get out of sync if ( ! isset( $labels[ $value ] ) ) { continue; } $label = apply_filters( 'jobify_registration_role_' . $value, $labels[ $value ] ); $options[] = '<option value="' . $value . '"' . selected( $default, $value, false ) . '>' . esc_attr( $label ) . '</option>'; } $options = implode( '', $options ); ?> <p class="form-row form-row-wide"> <label for="reg_role"><?php _e( 'Register As', 'jobify' ); ?></label> <select name="reg_role" class="jobify-registration-role"><?php echo $options; ?></select> </p> <?php } }
「$options」の値が取得できません。
作成したコード↓<?php add_action('nsl_before_register', function ($provider) { add_filter('nsl_registration_require_extra_input', function ($askExtraData) { return true; }); /** You can use nsl_registration_form_start and nsl_registration_form_end action. */ add_action('nsl_registration_form_start', function ($data) { ?> <?php function new_Register( $data ) { if ( ! isset( $_POST['reg_role'] ) ) { return $data; } $role = esc_attr( $_POST['reg_role'] ); $whitelist = $this->get_registration_roles(); if ( ! in_array( $role, array_keys( $whitelist ) ) ) { return $data; } $data['role'] = $role; return $data; } function get_allowed_roles() { $roles = get_theme_mod( 'registration-roles', array( 'employer' ) ); if ( '' == $roles ) { return array(); } if ( ! is_array( $roles ) ) { $roles = explode( ',', $roles ); } $roles = array_map( 'trim', $roles ); return $roles; } function get_editable1_roles() { global $wp_roles; $all_roles = $wp_roles->roles; $editable_roles = apply_filters( 'editable_roles', $all_roles ); return $editable_roles; } function get_registration_roles() { add_filter( 'editable_roles', array( $this, 'editable_roles' ) ); $roles = $this->get_editable1_roles(); if ( empty( $roles ) ) { return array(); } $value = array_keys( $roles ); $labels = wp_list_pluck( $roles, 'name' ); $options = array_combine( $value, $labels ); remove_filter( 'editable_roles', array( $this, 'editable_roles' ) ); return $options; } function editable_roles( $roles ) { $remove = apply_filters( 'jobify_removed_roles', array( 'administrator', 'editor', 'author', 'contributor', 'shop_manager' ) ); foreach ( $remove as $role ) { unset( $roles[ $role ] ); } return $roles; } function register_form() { $default = get_theme_mod( 'registration-default', array( 'employer' ) ); $roles = $this->get_allowed_roles(); $labels = $this->get_registration_roles(); if ( empty( $roles ) ) { return; } if ( 1 == count( $roles ) ) { echo '<input type="hidden" value="' . esc_attr( $roles[0] ) . '" name="reg_role" />'; return; } $options = array(); foreach ( $roles as $value ) { // in case things get out of sync if ( ! isset( $labels[ $value ] ) ) { continue; } $label = apply_filters( 'jobify_registration_role_' . $value, $labels[ $value ] ); $options[] = '<option value="' . $value . '"' . selected( $default, $value, false ) . '>' . esc_attr( $label ) . '</option>'; } $options = implode( '', $options );var_dump($options); } ?> <p class="form-row form-row-wide"> <label for="reg_role"><?php _e( 'Register As', 'jobify' ); ?></label> <select name="reg_role" class="jobify-registration-role"><?php echo $options; ?></select> </p> <?php }); add_action('nsl_registration_store_extra_input', function ($user_id, $data) { add_user_meta($user_id, 'reg_role', $data['role'] ); }, 10, 2); });
構文チェックは問題ないのですが、var_dump($options);としても何も表示されないので、function以降「role」の取得が出来ていないようです。
※取得後にどうやってユーザーロールを追加するのかという問題もありますが…どなたかお力を貸して頂けないでしょうか?
フォーラム: プラグイン
返信が含まれるトピック: ソーシャル登録の前にユーザーに権限を選択させる方法プラグインの作者に問い合わせたところ
「サイトで使用できる可能性のあるすべてのユーザーロールを一覧表示するカスタムコードを記述し、ユーザーが選択できるものをドロップダウンリストに表示してから、選択したロールをユーザーに割り当てます。」
という回答でした。
すべてのユーザーロールを取得する方法が分からなかったので、
単純にドロップリストで選択した値が一致すれば
それに応じてユーザーロールを割り当てれば良いのではと思ったのですが、
私の知識ではうまくいかないですね。。。どうやったらユーザーロールを割り当てることが出来るのでしょうか?
// ============================================================================= add_action('nsl_before_register', function ($provider) { /** @var $provider NextendSocialProvider */ /** * You must return true if you want to add custom fields */ add_filter('nsl_registration_require_extra_input', function ($askExtraData) { return true; }); add_filter('nsl_registration_validate_extra_input', function ($userData, $errors) { /** @var $errors WP_Error */ $isPost = isset($_POST['submit']); if ($isPost) { /** * You must add an error if your fields are not filled or does not fulfill your validation. * If no errors added, that means that the register form is fine. */ if (!empty($_POST['type']) && is_string($_POST['type'])) { $userData['type'] = $_POST['type']; } else { $userData['type'] = ''; $errors->add('favorite_color_missing', '<strong>' . __('ERROR') . '</strong>: Favorite Color can not be empty.', array('form-field' => 'favorite_color')); } } else { /** * Fill up user data with default values to prevent the notice in the form */ $userData['type'] = ""; } return $userData; }, 10, 2); /** You can use nsl_registration_form_start and nsl_registration_form_end action. */ add_action('nsl_registration_form_start', function ($userData) { ?> <select name="type"> <? $Options = array("Jobseeker"=>"Jobseeker","Employer"=>"Employer"); foreach($Options as $key=>$value){ $selected=""; if($key==$item["type"]){$selected ="selected";} print "<option value=\"$key\"$selected>$value</option>\n"; } ?> </select> <?php }); /** * $user_id contains the created user's id * $userData contains the previously validated input */ $user = new WP_User( $id ); if ($key == "Jobseeker"){ $user-> set_role('Jobseeker'); } elseif ($key == "Employer"){ $user-> set_role('Employer'); } else{} add_action('nsl_registration_store_extra_input', function ($user_id, $userData) { add_user_meta($user_id, 'type', $userData['type']); }, 10, 2); });
フォーラム: 使い方全般
返信が含まれるトピック: プラグイン無しでパンくずリストを出力させる方法う~ん、解決したと思ったのですが、
sample.com/blog(ブログ記事)/カテゴリ/
に移動したときに
パンくずが
HOME→カテゴリ
になってしまいますね。。。
HOME→ブログ記事(blog)→カテゴリ
になって欲しいのですが、中々難しいです…。
フォーラム: 使い方全般
返信が含まれるトピック: プラグイン無しでパンくずリストを出力させる方法ishitaka様
構造マークアップ化のためのコードについてですが
2か所変更することで解決(多分)しました。変更前
if (is_home() || is_front_page()) return false;
変更後
if (is_front_page()) return false;
変更前
} elseif (is_page()) { /** * 固定ページ ( $wp_obj : WP_Post ) */
変更後
} elseif (is_page() || is_home() ) { /** * 固定ページ ( $wp_obj : WP_Post ) */
様々なアドバイスありがとうございました。
フォーラム: 使い方全般
返信が含まれるトピック: プラグイン無しでパンくずリストを出力させる方法ishitaka様
お世話になります。
※返信がスパム判定されたので再送です
どうもキャッシュの関係でリンクに色がついていたようです。。。
コードはどこ(} elseif ( is_single() ) { のブロック内?)に追加しましたか?
'</li>'; (ここに追加しました。) if ( is_attachment() ) {
表示はされているので問題はないと思いますがいかがでしょうか?
それから並行してパンくずリストの構造マークアップ化のためのコードをいじっているのですが
以下
if (!function_exists('custom_breadcrumb')) { function custom_breadcrumb($wp_obj = null) {$current_url = (empty($_SERVER['http']) ? 'http://' : 'https://') . $_SERVER['http_HOST'] . $_SERVER['REQUEST_URI']; $html = ""; if (is_home() || is_front_page()) return false; $wp_obj = $wp_obj ?: get_queried_object(); $position = 1; $html .= '<ul class="breadcrumb" itemscope itemtype="schema.org/BreadcrumbList">' . '<li itemprop="itemListElement" itemscope itemtype="schema.org/ListItem" class="home">' . '<a itemprop="item" href="' . home_url() . '">' . '<span itemprop="name">HOME</span>' . '<meta itemprop="position" content="' . $position . '" />' . '</a>' . '</li>'; $position++; if ( $wp_obj->post_type === 'post' && $page_for_posts = get_option( 'page_for_posts' ) ) { $html .= '<li itemprop="itemListElement" itemscope itemtype="schema.org/ListItem">' . '<a itemprop="item" href="' . get_the_permalink( $page_for_posts ) . '">' . '<span itemprop="name">' . get_the_title( $page_for_posts ) . '</span>' . '<meta itemprop="position" content="' . $position . '" />' . '</a>' . '</li>'; $position++; } if (is_attachment()) { /** * 添付ファイルページ ( $wp_obj : WP_Post ) * ※ 添付ファイルページでは is_single() も true になるので先に分岐 */ $html .= '<li itemprop="itemListElement" itemscope itemtype="schema.org/ListItem" class="current">' . '<span itemprop="name">' . $wp_obj->post_title . '</span>' . '<meta itemprop="position" content="' . $position . '" />' . '</li>'; } elseif (is_single()) { /** * 投稿ページ ( $wp_obj : WP_Post ) */ $post_id = $wp_obj->ID; $post_type = $wp_obj->post_type; $post_title = $wp_obj->post_title; // カスタム投稿タイプかどうか if ($post_type !== 'post') { $the_tax = ""; //サイトに合わせ、投稿タイプごとに分岐させて指定 // 投稿タイプに紐づいたタクソノミーを取得 (投稿フォーマットは除く) $tax_array = get_object_taxonomies($post_type, 'names'); foreach ($tax_array as $tax_name) { if ($tax_name !== 'post_format') { $the_tax = $tax_name; break; } } //カスタム投稿タイプ名の表示 $html .= '<li itemprop="itemListElement" itemscope itemtype="schema.org/ListItem">' . '<a itemprop="item" href="' . get_post_type_archive_link($post_type) . '">' . '<span itemprop="name">' . get_post_type_object($post_type)->label . '</span>' . '<meta itemprop="position" content="' . $position . '" />' . '</a>' . '</li>'; $position++; } else { $the_tax = 'category';//通常の投稿の場合、カテゴリーを表示 } // タクソノミーが紐づいていれば表示 if ($the_tax !== "") { $child_terms = array(); // 子を持たないタームだけを集める配列 $parents_list = array(); // 子を持つタームだけを集める配列 // 投稿に紐づくタームを全て取得 $terms = get_the_terms($post_id, $the_tax); if (!empty($terms)) { //全タームの親IDを取得 foreach ($terms as $term) { if ($term->parent !== 0) $parents_list[] = $term->parent; } //親リストに含まれないタームのみ取得 foreach ($terms as $term) { if (!in_array($term->term_id, $parents_list)) $child_terms[] = $term; } // 最下層のターム配列から一つだけ取得 $term = $child_terms[0]; if ($term->parent !== 0) { // 親タームのIDリストを取得 $parent_array = array_reverse(get_ancestors($term->term_id, $the_tax)); foreach ($parent_array as $parent_id) { $parent_term = get_term($parent_id, $the_tax); $html .= '<li itemprop="itemListElement" itemscope itemtype="schema.org/ListItem">' . '<a itemprop="item" href="' . get_term_link($parent_id, $the_tax) . '">' . '<span itemprop="name">' . $parent_term->name . '</span>' . '<meta itemprop="position" content="' . $position . '" />' . '</a>' . '</li>'; $position++; } } // 最下層のタームを表示 $html .= '<li itemprop="itemListElement" itemscope itemtype="schema.org/ListItem">' . '<a itemprop="item" href="' . get_term_link($term->term_id, $the_tax) . '">' . '<span itemprop="name">' . $term->name . '</span>' . '<meta itemprop="position" content="' . $position . '" />' . '</a>' . '</li>'; $position++; } } // 投稿自身の表示 $html .= '<li itemprop="itemListElement" itemscope itemtype="schema.org/ListItem" class="current">' . '<a itemprop="item" href="' . $current_url . '" class="disabled">' . '<span itemprop="name">'. $post_title .'</span>' . '<meta itemprop="position" content="' . $position . '" />' . '</a>' . '</li>'; } elseif (is_page()) { /** * 固定ページ ( $wp_obj : WP_Post ) */ $page_id = $wp_obj->ID; $page_title = $wp_obj->post_title; // 親ページがあれば順番に表示 if ($wp_obj->post_parent !== 0) { $parent_array = array_reverse(get_post_ancestors($page_id)); foreach ($parent_array as $parent_id) { $html .= '<li itemprop="itemListElement" itemscope itemtype="schema.org/ListItem">' . '<a itemprop="item" href="' . get_permalink($parent_id) . '">' . '<span itemprop="name">' . get_the_title($parent_id) . '</span>' . '<meta itemprop="position" content="' . $position . '" />' . '</a>' . '</li>'; $position++; } } // 投稿自身の表示 $html .= '<li itemprop="itemListElement" itemscope itemtype="schema.org/ListItem" class="current">' . '<a itemprop="item" href="' . $current_url . '" class="disabled">' . '<span itemprop="name">' . $page_title . '</span>' . '<meta itemprop="position" content="' . $position . '" />' . '</a>' . '</li>'; } elseif (is_post_type_archive()) { /** * 投稿タイプアーカイブページ ( $wp_obj : WP_Post_Type ) */ $html .= '<li itemprop="itemListElement" itemscope itemtype="schema.org/ListItem">' . '<a itemprop="item" href="' . $current_url . '" class="disabled">' . '<span itemprop="name">' . $wp_obj->label . '</span>' . '<meta itemprop="position" content="' . $position . '" />' . '</a>' . '</li>'; } elseif (is_archive()) { /** * タームアーカイブ ( $wp_obj : WP_Term ) */ $term_id = $wp_obj->term_id; $term_name = $wp_obj->name; $tax_name = $wp_obj->taxonomy; /* タクソノミーに紐づくカスタム投稿タイプを出力 */ // 親ページがあれば順番に表示 if ($wp_obj->parent !== 0) { $parent_array = array_reverse(get_ancestors($term_id, $tax_name)); foreach ($parent_array as $parent_id) { $parent_term = get_term($parent_id, $tax_name); $html .= '<li itemprop="itemListElement" itemscope itemtype="schema.org/ListItem">' . '<a itemprop="item" href="' . get_term_link($parent_id, $tax_name) . '">' . '<span itemprop="name">' . $parent_term->name . '</span>' . '<meta itemprop="position" content="' . $position . '" />' . '</a>' . '</li>'; $position++; } } // ターム自身の表示 $html .= '<li itemprop="itemListElement" itemscope itemtype="schema.org/ListItem" class="current">' . '<a itemprop="item" href="' . $current_url . '" class="disabled">' . '<span itemprop="name">' . $term_name . '</span>' . '<meta itemprop="position" content="' . $position . '" />' . '</a>' . '</li>'; } elseif (is_search()) { /** * 検索結果ページ */ $html .= '<li itemprop="itemListElement" itemscope itemtype="schema.org/ListItem" class="current">' . '<span itemprop="name">「' . get_search_query() . '」で検索した結果</span>' . '<meta itemprop="position" content="' . $position . '" />' . '</li>'; } elseif (is_404()) { /** * 404ページ */ $html .= '<li itemprop="itemListElement" itemscope itemtype="schema.org/ListItem" class="current">' . '<span itemprop="name">お探しの記事は見つかりませんでした。</span>' . '<meta itemprop="position" content="' . $position . '" />' . '</li>'; } else { /** * その他のページ */ $html .= '<li itemprop="itemListElement" itemscope itemtype="schema.org/ListItem">' . '<span itemprop="name">' . get_the_title() . '</span>' . '</li>'; } $html .= '</ul>'; return $html; } }
こんな感じにしても上手くいかないのですよねぇ…。
sample.com/blog(ブログ記事)/カテゴリ/投稿ページ
は問題ないのですが、
sample.com/blog(ブログ記事)/
に移動するとパンくずリストが表示されなくなります。
フォーラム: 使い方全般
返信が含まれるトピック: プラグイン無しでパンくずリストを出力させる方法パンくず HOME(リンクあり)→ブログ記事(リンクなし)
この場合の条件がわかりません。どのような場合(ページ?)でしょうか?ishitaka様、返信内容が分かり難くてすみません。
sample.com/blog(ブログ記事)/
を表示した場合です。
つまりブログ記事のアーカイブページになります。現状は、
HOME(sample.com リンクあり)→ブログ記事(blog リンクあり)
なので、
パンくずリストの最後のページタイトル部分をリンク無しに出来ないものかと。。。
ご理解頂けましたでしょうか?
フォーラム: 使い方全般
返信が含まれるトピック: プラグイン無しでパンくずリストを出力させる方法ishitaka様
ご丁寧に回答頂き有難うございます。
サンプルコードを試したところ、希望通りのパンくずリストが表示されました。
差し支えなければもう一つご回答いただけると助かるのですが、
パンくず HOME→ブログ記事
となった時にパンくずの最後(ブログ記事)をaタグ無しにすることは可能でしょうか?
今は
パンくず HOME(リンクあり)→ブログ記事(リンクあり)
ですが、これを
パンくず HOME(リンクあり)→ブログ記事(リンクなし)
という形にしたいと思います。
サンプルコードでもパンくずの終わりはリンク無しを出力するようになっていて、
コードを見るとforeachで末尾がそうでないかを判定している(?)ように見えるのですが、ちょっと分かりませんでした。つまり、
パンくず HOME→ブログ記事(リンクあり)→カテゴリ→投稿ページ
パンくず HOME→ブログ記事(リンクなし)
というのを実現したいと考えております。
アドバイス頂ければ幸いです。
フォーラム: 使い方全般
返信が含まれるトピック: WordPressのカテゴリーをtableで出力する方法RICK様、ishitaka様、ご回答ありがとうございました。
色々な方法があるものですね(^^;)RICK様は足し算による解決方法(countの値が一定の数に達した場合、タグを出力)、で
ishitaka様はカテゴリ数を分割して2つカウントするごとにタグを出力する方法(でしょうか?)お二方には貴重な時間を割いて頂きまして本当にありがとうございました。
フォーラムなのでベストアンサー機能がなく残念なのですが…トピックを閉じたいと思います。フォーラム: 使い方全般
返信が含まれるトピック: WordPressのカテゴリーをtableで出力する方法munyagu様、ishitaka様
返信ありがとうございます。えー、頭が痛いです(^^;)
要は<td>2行ごとに<tr>を出したいのですが、(出来れば<tr>と<tr class=”hoge”>を交互に)
今のところ行き着いた先が、テーブル<TR></TR>の処理についてのページで、ちょっと情報が古いのかなと思っています。
もう少し試行錯誤してみます。。。フォーラム: テーマ
返信が含まれるトピック: テーマ「ColorMag」で更新日を表示する方法CG様
返信ありがとうございます。
解決策が見つかりました。
style.cssの
.below-entry-meta .updated { display: none;}
の部分を以下に変更することで更新日が表示されました。
.below-entry-meta .updated { display: inline;}
フォーラム: プラグイン
返信が含まれるトピック: AnsPressの質問ページで子カテゴリーを色分けしたいどうも色分けだけだとカテゴリーが増えたときに対応大変そうなので、新たにトピックを立てることにしました。
アドバイスを頂いた皆様ありがとうございました。、フォーラム: プラグイン
返信が含まれるトピック: AnsPressの質問ページで子カテゴリーを色分けしたいishitaka様
はい、テーマの functions.php などに記述します。なお、コードはあくまでも例です。そのままでは動作しません。
コード動きました。なるほど、こういうやり方があるのですね。
すみません、AnsPress プラグインを使用したことがなく詳しいことは分かりません。m(__)m
プラグインのサポートページ(英語ですが)があるので、そちらを利用されてみてはどうでしょうか?
https://anspress.io/questions/こちらこそ無理をいってすみませんでした。
あとは自力でなんとかします。有難うございました。フォーラム: プラグイン
返信が含まれるトピック: AnsPressの質問ページで子カテゴリーを色分けしたいishitaka様
返信ありがとうございます。
>AnsPress form and validation API でカスタムフォームを作成すればできそうです。
>https://anspress.io/resources/faq/anspress-form-and-validation-api/そのようなのですが、さっぱり分かりません(^^;)
色々試行錯誤しているのですが、
1.custom-form.phpはどこに置けばいいのか?
2.anspress() – > get_form( ‘sample_form’) – > generate();
はどのファイルに書けばいいのか?
AnsPressのフォーラムで質問しても全く返答がないので半ば諦め気味です。とりあえず強引に”includes/class-form-hooks.php”の38行目以降に、
新しいフィールドを挿入することまでは出来ました。JavaScriptで色分けするコードはテーマのfunction.phpの記述すればよいのでしょうか?
現在は色々試してみた結果、プルダウン表示の際に、親カテゴリーと子カテゴリーが階層上にならない(子カテゴリだけインデントされない)ので子カテゴリーのの代わりにタグを使い、
タグをプルダウン化しようと思っているのですが、tags.php内の
‘type’ => ‘tags’を
‘type’ => ‘select’にしてもタグに設定した項目が表示されません。ついでにお聞きする形で大変申し訳ないのですが、
この件について何か良い方法はありますでしょうか?AnsPressはカスタマイズが容易ということだったのですが、
思った以上に難しく、またカスタマイズの参考になるサイトがほとんどないので難渋しております。
ご指導頂ければ幸いです。フォーラム: プラグイン
返信が含まれるトピック: AnsPressの質問ページで子カテゴリーを色分けしたい