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
11 changes: 9 additions & 2 deletions acf-conditional-taxonomy-rules.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
Plugin Name: ACF Conditional Taxonomy Rules
GitHub Plugin URI: https://github.com/mattkeys/ACF-Conditional-Taxonomy-Rules
Description: Allow conditional rules to use 'taxonomy' field types
Version: 3.0.1
Author: mattkeys
Version: 3.0.1.1
Author: mattkeys, MadMaxInfinity
Author URI: http://mattkeys.me
Text Domain: acf-conditional-taxonomy-rules
Domain Path: /languages/
License: GPL2
License URI: https://www.gnu.org/licenses/gpl-2.0.html
*/
Expand All @@ -25,5 +27,10 @@
define( 'ACFCTR_PUBLIC_PATH', plugin_dir_url( __FILE__ ) );
}

// Name to the plugin's directory
if ( ! defined( 'ACFCTR_DIRECTORY_NAME' ) ) {
define( 'ACFCTR_DIRECTORY_NAME', dirname(plugin_basename(__FILE__)));
}

// Load the plugin
require_once 'core/ACFCTR_Core.php';
11 changes: 11 additions & 0 deletions core/ACFCTR_Core.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,22 @@ public function init()
{
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_script' ) );
add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_script' ) );
load_plugin_textdomain(
'acf-conditional-taxonomy-rules',
false,
ACFCTR_DIRECTORY_NAME .'/languages/'
);
}

public function enqueue_script()
{
wp_enqueue_script( 'acf-input-conditional-taxonomy', ACFCTR_PUBLIC_PATH . 'includes/input_conditional_taxonomy.js', array( 'acf-input' ), '3.0.0' );
$localize = array(
'term_id_equals' => __('Selection Term ID equals', 'acf-conditional-taxonomy-rules'),
'term_id_not_equal' => __('Selection Term ID not equal to', 'acf-conditional-taxonomy-rules')
);
$localize = apply_filters('acfict_enqueue_localize', $localize);
wp_localize_script('acf-input-conditional-taxonomy', 'acfict', $localize);
}

}
Expand Down
4 changes: 2 additions & 2 deletions includes/input_conditional_taxonomy.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
var TaxonomyEqualTo = acf.Condition.extend({
type: 'taxonomyEqualTo',
operator: '==',
label: 'Selection Term ID equals',
label: acfict.term_id_equals,
fieldTypes: [ 'taxonomy' ],
match: function( rule, field ){
var val = field.val();
Expand All @@ -41,7 +41,7 @@
var TaxonomyNotEqualTo = TaxonomyEqualTo.extend({
type: 'taxonomyNotEqualTo',
operator: '!=',
label: "Selection Term ID not equal to",
label: acfict.term_id_not_equal,
fieldTypes: ['taxonomy'],
match: function (rule, field) {
return !TaxonomyEqualTo.prototype.match.apply(this, arguments)
Expand Down
Binary file added languages/acf-conditional-taxonomy-rules-fr_FR.mo
Binary file not shown.
41 changes: 41 additions & 0 deletions languages/acf-conditional-taxonomy-rules-fr_FR.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
msgid ""
msgstr ""
"Project-Id-Version: ACF Conditional Taxonomy Rules\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-04-15 08:36+0000\n"
"PO-Revision-Date: 2023-04-15 09:04+0000\n"
"Last-Translator: DebugAdminLprR\n"
"Language-Team: Français\n"
"Language: fr_FR\n"
"Plural-Forms: nplurals=2; plural=n > 1;\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Loco https://localise.biz/\n"
"X-Loco-Version: 2.6.4; wp-6.2\n"
"X-Domain: acf-conditional-taxonomy-rules"

#. Name of the plugin
msgid "ACF Conditional Taxonomy Rules"
msgstr ""

#. Description of the plugin
msgid "Allow conditional rules to use 'taxonomy' field types"
msgstr ""
"Permet aux règles conditionnelles d'utiliser les champs de type \"taxonomie\""

#. Author URI of the plugin
msgid "http://mattkeys.me"
msgstr ""

#. Author of the plugin
msgid "mattkeys"
msgstr ""

#: core/ACFCTR_Core.php:24
msgid "Selection Term ID equals"
msgstr "La sélection a pour valeur"

#: core/ACFCTR_Core.php:25
msgid "Selection Term ID not equal to"
msgstr "La sélection n’a pas pour valeur"
41 changes: 41 additions & 0 deletions languages/acf-conditional-taxonomy-rules.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: ACF Conditional Taxonomy Rules\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-04-15 08:36+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: \n"
"Language: \n"
"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Loco https://localise.biz/\n"
"X-Loco-Version: 2.6.4; wp-6.2\n"
"X-Domain: acf-conditional-taxonomy-rules"

#. Name of the plugin
msgid "ACF Conditional Taxonomy Rules"
msgstr ""

#. Description of the plugin
msgid "Allow conditional rules to use 'taxonomy' field types"
msgstr ""

#. Author URI of the plugin
msgid "http://mattkeys.me"
msgstr ""

#. Author of the plugin
msgid "mattkeys"
msgstr ""

#: core/ACFCTR_Core.php:24
msgid "Selection Term ID equals"
msgstr ""

#: core/ACFCTR_Core.php:25
msgid "Selection Term ID not equal to"
msgstr ""
10 changes: 7 additions & 3 deletions readme.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
=== ACF Conditional Taxonomy Rules ===
Contributors: mattkeys
Contributors: mattkeys, MadMaxInfinity
Tags: ACF, Advanced Custom Fields, Conditional, Taxonomy, Conditional Taxonomy
Requires at least: 3.6
Tested up to: 4.8
Tested up to: 6.1.4
Stable tag: trunk
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Expand All @@ -24,6 +24,10 @@ NOTE: This plugin *requires* ACF v5.7.0+. This plugin is not designed to work on

== Changelog ==

= 3.0.1.1 =
* Added localization
* Added french translation

= 3.0.1 =
* Bugfix enqueuing script in footer sometimes causing timing issues
* Cleanup some unneeded code from v2.0.0
Expand All @@ -40,4 +44,4 @@ NOTE: This plugin *requires* ACF v5.7.0+. This plugin is not designed to work on
* Fixing a variety of bugs related to adding/removing taxonomy conditional settings in the admin area, particularly when there are multiple conditions

= 1.0.0 =
* This is the first public release
* This is the first public release