codemonkeynorth
Forum Replies Created
-
Forum: Plugins
In reply to: [Custom Content Shortcode] I don’t understand compare=between function@pchlorenzo I think you can do it like this
[if exists] [loop field=rsi_derechos_humanos compare=between value=10,110 include=this] [field rsi_derechos_humanos] [/loop] [else] algo va mal [/if]It’s still doing a loop so it’ll check all pages if you leave out
include=thisI don’t think
compareworks with just[if field...]. Presumably it’s doing ameta_querywhereas[if field...isn’t
https://codex.wordpress.org/Class_Reference/WP_Meta_QueryP.s. don’t prefix ACF fields with
acfin the shortcode , just use[field rsi...- This reply was modified 5 years, 11 months ago by codemonkeynorth.
- This reply was modified 5 years, 11 months ago by codemonkeynorth.
Forum: Plugins
In reply to: [Custom Content Shortcode] Order Taxonomies by HierarchyDoes the example in the docs help?
https://prioritytravel.co.za/wp-admin/options-general.php?page=ccs_reference&tab=taxonomy
[for each=parent_category] Parent category: [each name] [-for each=children] [each name] is a child of {TERM_NAME} [--for each=children] [each name] is a child of {-TERM_NAME} and grandchild of {TERM_NAME} [/--for] [/-for] [/for]Forum: Plugins
In reply to: [Custom Content Shortcode] Accessing multiple value from a custom field@miyarakira another potential extra change:
on line 2501 of
includes/core/content.php} else { $id = do_shortcode('[field id]'); $array = get_post_meta( $id, $field, true ); // <== change to false }this then returns the field as an array as expected so this now works:
[array field=colour] [field value] [/array]Forum: Plugins
In reply to: [Custom Content Shortcode] Accessing multiple value from a custom fieldIt would be great if @miyarakira could look into this.
with the above change to
content.phpto allow for field arrays, also it seems inincludes/modules/pass.phpthat the code below is what breaks the[pass array...]functions(
$field_valueis being returned as a string not an array with the slower version)// Predefined or custom field } else { // $field_value = CCS_Content::get_prepared_field( $field, $post_id ); // Slower but will get date format, etc. $field_value = CCS_Content::content_shortcode($atts);if you swap those comments around so it uses the
get_prepared_fieldversion, this code now works[pass array=colour] Colour 1: {0}, Colour 2: {1} [/pass](Is it possible to get the length?)
(again it needs the previous modification forget_post_metato return an array)Forum: Plugins
In reply to: [Custom Content Shortcode] Accessing multiple value from a custom fieldpersonally I’d use an ACF repeater. I’m not sure CCS is set up to process this.
looking at this it would need a way to pass
single=falsetoget_post_metaand return an array maybe: https://developer.wordpress.org/reference/functions/get_post_meta/(Would be great if we could use
[pass array=some_field]and have it assume thereforesome_fieldneeds to be returned as the array)the code below isn’t future proof but gives you some option until the developer updates the plugin:
in the plugin
include/core/content.phpline 1927, you can try set this to false instead of true at the end
$result = get_post_meta($post_id, $field, false);This returns the field as a comma delimited string though not an array (not sure why), so the
[pass array...]functions don’t work and I’m not sure what knock on effects making this change would have eitherBut you could then use string functions though to get values
Colour 1: [format split="," part=1][field colour][/format] Colour 2: [format split="," part=2][field colour][/format]or..
[pass field=colour] Colour 1: [format split="," part=1]{COLOUR}[/format] Colour 2: [format split="," part=2]{COLOUR}[/format] [/pass]but it’s kind of messy solution
it also gives you access to a
passlooppass list check:
[set temp][field colour][/set] [pass vars] [-pass list='{TEMP}'] {-ITEM} [/-pass] [/pass]or more simply…
[pass field=colour] [-pass list='{FIELD}'] // creates a list from the comma separated values {-ITEM} [/-pass] [/pass]hope that’s of use
Forum: Plugins
In reply to: [Custom Content Shortcode] Dynamic Loop Postsrefer to the examples at:
https://www.cashme.com.br/wp-admin/options-general.php?page=ccs_reference&tab=passone of these should help?
[pass taxonomy_loop=category] Category: {TERM_NAME} [loop type=product category={TERM}] Product: [field title] Price: [field price] [/loop] [/pass][pass global=query fields=orderby,category] [loop type=post orderby='{ORDERBY}' category='{CATEGORY}'] ... [/loop] [/pass]Forum: Plugins
In reply to: [Custom Content Shortcode] Fatal error using [repeater]I believe
[repeater]is ACF-specificit uses this function https://www.advancedcustomfields.com/resources/have_rows/
I guess ideally it should check for existence of the function before trying to use it though
Forum: Plugins
In reply to: [Custom Content Shortcode] Check if two fields have the same value@baldidiot here’s one way…
[pass fields=test1,test2] [if check={TEST1} value={TEST2}] fields are equal [else] fields not not equal [/if] [/pass]Forum: Plugins
In reply to: [Custom Content Shortcode] Conditional logic with ACF fields[if not field=contact1_email] No email supplied [else] [field key=contact1_email] [/if]or
[if field=contact1_email] Email: [field contact1_email] [/if]check out
[if exists]as well, I believe it is used to check if the actual field is even present on the post, rather to check the valuefind the docs under /wp-admin/options-general.php?page=ccs_reference&tab=if
i found a workaround for now:
[if check={PARAM} value="{PARAM}"] param not passed [else] {PARAM} [/if]essentially if the param isn’t passed in the shortcode then
{PARAM}just equates to the literal string"{PARAM}"so it means it hasn’t parsed it to something elseForum: Plugins
In reply to: [Custom Content Shortcode] Repeater inside ACF Flexible Content?it appears
flexandrepeaterhave some shared functionality so this works[layout icon_list] <b>Title:</b> [field title] [if field=list] <ul> [-repeater list] <li>[field text]</li> [/-repeater] </ul> [/if] [/layout]essentially nesting the
repeaterwith a-Forum: Plugins
In reply to: [Custom Content Shortcode] ACF Extended Custom Gutenberg Blocks not renderingI worked it out – leaving here for reference.
The
filterparameter needs adding to thecontentshortcode not the loop etceg:
[loop type=post name=hello-world] [content filter=true] [/loop]or
[content name=hello-world filter=true]Forum: Plugins
In reply to: [ACF: Better Search] Search whole words onlyHi Mateusz,
sorry we’ve been tied up with deadlines!
All seems good so far, I’ll test this new release out on our dev site
thanks again for your work
J.Forum: Plugins
In reply to: [ACF: Better Search] Search whole words onlyseems to work well so far. I’ll give it a thorough test tomorrow.
as per my example “oug” now does not bring back search results, but “through” does… which is what we want
it also picks up a search for “studies” when the copy is “… studies.”, so it’s correctly ignoring punctuation there which I’d expect from that expression.
I know regex is supposedly slow, but it’s alright mostly
thanks for looking into this!
- This reply was modified 6 years, 2 months ago by codemonkeynorth.