Forum Replies Created

Viewing 15 replies - 31 through 45 (of 82 total)
  • Thread Starter berttervoert

    (@berttervoert)

    Hi @jory,

    Update: after playing around some more with the shortcode and looking at the links provided at the example you suggested, I got it working. The shortcode is now as follows:

    [pods name="clubleden" where="function.meta_value != 'Lid'" orderby="FIELD(functie.meta_value, 'Voorzitter', 'Penningmeester', 'Secretaris', 'Bestuurslid')"]
    {@post_title}
    {@functie}
    [/pods]

    Now I’ll have to get it in a template, to get al the necessary html markup in place.

    Thread Starter berttervoert

    (@berttervoert)

    Hi @jory,

    I looked at the example you suggested, but I can’t get the orderby param to work within the shortcode. It either ignores the orderby part all together or it displays nothing and gives an wordpress database error. Might it be so that it isn’t possible to use ‘case’ with the ‘orderby’ statement in the shortcode? And how about the ‘Functie’ value ‘Bestuurslid’, which has two entries?

    The shortcode I tried which seems to ignore the orderby part:

    [pods name=”clubleden” where=”functie.meta_value != ‘Lid'” orderby=”case when functie.meta_value = ‘Voorzitter’ then 1 when functie.meta_value = ‘Penningmeester’ then 2 end”]
    {@post_title}
    (@functie}
    [/pods]

    (I didn’t add all the value for ‘functie’ just for testing purposes).

    Thanks in advance,
    Bert

    Thread Starter berttervoert

    (@berttervoert)

    final update:

    It looks like I messed something up with the settings for date field. I deleted it and recreated it and now it works correct: it shows an empty field if the stored value is 0000-00-00 and the stored date if a date has been entered in the form.

    Thanks again.
    Bert

    Thread Starter berttervoert

    (@berttervoert)

    Strange thing: I deleted the lid_sinds column and redid it and now it displays correct. When a date for this field is entered, it displays that date and when it was left blank (0000-00-00 in db) the field in the column is left blank. Probably messed something up in the settings the first time.
    Sorry for that, but thank you for your time and answers!
    Bert.

    Thread Starter berttervoert

    (@berttervoert)

    Hi Jory,

    we’re trying to create a hook that lets me alter the value when the raw value is 0000-00-00. This was their explanation why the current date is displayed:

    If you use the custom field column with type set to date it will try to parse a date with strtotime and format it according to the date format that has been applied in the column settings. Apparently, 0000-00-00 is parsed as the current date. While a 0000-00-00 format might not be ideal to have in the database, it is not invalid. I see two options to address this issue.

    I’m still figuring out how to create the hook, since the given info is minimal (for me!), but we’re still corresponding about that.

    Thread Starter berttervoert

    (@berttervoert)

    I’m using a child theme with its own functions.php file, so that’s not a problem.
    I looked at the examples you suggested in you first answer. I think I need the first example there, but then I don’t know how to check for the meta key.

    In the database I found the info about the column that displays the date:
    a:13:{s:4:”type”;s:11:”column-meta”;s:5:”label”;s:9:”Lid sinds”;s:5:”width”;s:0:””;s:10:”width_unit”;s:1:”%”;s:5:”field”;s:9:”lid_sinds”;s:10:”field_type”;s:0:””;s:6:”before”;s:0:””;s:5:”after”;s:0:””;s:4:”sort”;s:3:”off”;s:11:”inline-edit”;s:3:”off”;s:9:”bulk-edit”;s:3:”off”;s:15:”smart-filtering”;s:3:”off”;s:6:”export”;s:3:”off”;}s:13:”5f8f3be848ba6″;
    Do I need to use any of this info for $column and/or meta key?
    Does the function get called automatically by your plugin or do I have to add something else for that?

    Thank you for the info so far.

    Thread Starter berttervoert

    (@berttervoert)

    Thank you for your answer. I do still have some questions:
    – Where do I put the function as can be found on github (opt 1 of your answer)? Does this go in the functions.php file or does it need to go somewhere else?
    – what is the $ID? and where can I find it?
    – what is the AC\column $column?

    Thanks in advance,
    Bert

    Thread Starter berttervoert

    (@berttervoert)

    Jory,

    I think the problem isn’t coming from pods, but from wordpress itself or the plugin Admin Columns, so I’ll look there for a solution. Thank you for your reactions so far and I’ll mark this as resolved.

    Thread Starter berttervoert

    (@berttervoert)

    Hi jory,

    the default value is indeed empty.
    I havn’t gotten to the display part yet. As I wrote in the initial post, I’m talking bout the overview on the admin page which displays all the entries for this pod. I’ve added a screenshot: the column Lid sinds should be empty, but shows the date for today.

    I’ve checked the database, and the value stored for this date field if left empty is 0000-00-00, which is correct. Why then does it show the current date on the admin overview page?

    https://www.dropbox.com/s/t8txlzmpi72tj77/Screenshot_2020-10-22%20Clubleden%20%E2%80%B9%20De%20Door%28en%29trappers%20%E2%80%94%20WordPress.png?dl=0

    Thread Starter berttervoert

    (@berttervoert)

    Hello Jory,

    I’m using the latest version of pods (v.2.7.22). Has the issue returned? What can I do to correct this?

    Thread Starter berttervoert

    (@berttervoert)

    Ok, thank you, I’ll look into that.

    I was wondering if I made a mistake in my line of thinking as I discribed above: I can make a function that returns a shortcode, but will this shortcode be executed or only be displayed? Do you have any thoughts on that?

    I’ll play around with your suggestion and let you know how it works (or not).

    Thanks,
    Bert

    Thread Starter berttervoert

    (@berttervoert)

    Ok, I created two pods with fields. The second pod has a relationship field for the title, which gets populated with the titles from the first pod. And when there are no entries yet for pod 1 it shows a button to add a new entry for pod 1. When I press on the button the form for pod 1 opens, so this all works well!

    The question I have is this: do I have to create a relationship field for pod 1 that links it to pod two or is this not always necessary?

    I just started to play with the plugin, but I’m already liking it!

    Bert.

    Forum: Plugins
    In reply to: [CMB2] make fields required
    Thread Starter berttervoert

    (@berttervoert)

    Ok, thanks, I’ll try that out. If I run into more problems, I’ll start a new post.

    Thank you so far.

    Forum: Plugins
    In reply to: [CMB2] make fields required
    Thread Starter berttervoert

    (@berttervoert)

    Does this mean that CMB2 cannot be used with Gutenberg or does that need some sort of workaround. Or is it possible to create these cutom post types without Gutenberg and still use Gutenberg for the rest of the website?

    I saw that I have the Gutenberg editor enabled for my custom post type. Is it enough if I remove this line:

    'show_in_rest' => true,

    Forum: Plugins
    In reply to: [CMB2] make fields required
    Thread Starter berttervoert

    (@berttervoert)

    I have Gutenberg block editor installed on this development environment. I’m using the cmb code in a plugin, not in functions.php. I think it shouldn’t make a difference, but I’m not sure. If it would help I can post the entire code of my plugin via a dropbox link. Please let me know.

Viewing 15 replies - 31 through 45 (of 82 total)