All my post types, content templates and views are set. And all of sudden a lot of functions stopped working. When I'm trying to add pictures, wrong pictures come out in the front. The address field in post editor is not loading the map anymore and it all seems to come from this error (so this error comes in the console when I want to add a new post of custom post type):
jquery.validate.min.js?ver=1.8.1:15 Uncaught TypeError: Cannot read property 'settings' of undefined
quicktags.min.js?ver=5.1.1:1 Uncaught TypeError: Cannot read property 'bs_component_show_hide_button' of undefined
I've already tried to switch themes, deactivate all plugins, nothing helps.
For example: try to add a new custom post, for example: Add New Essential, you will see that when you try to upload an image (click checkbox premium to be able to upload a header image) it will first refresh the page and after that you can upload it, but it is not shown on the front correctly.
The only thing that made it work again was deleting all relationships, but obviously I can't do that because the whole site is build off them.
Ok, the problem above I seemed to have solved by not opening specific custom fields by checking a checkbox in the post editors.
But now another problem has come up. I used to be able to output title, alt, caption, id and tags by attachments url's, but this somehow doesn't work anymore.
This is a shortcode example:
[wpv_display_file_name info="id" url="[wpv-post-featured-image size='full' output='url']"]
And this is the function I use:
add_shortcode( 'wpv_display_file_name', 'wpv_display_file_title_func');
function wpv_display_file_title_func($atts) {
[wpv-post-featured-image output="title"] - to display title of featured image
[wpv-post-featured-image output="description"] - to display the description of the featured image
Thats what I did. Just use the functions within Toolset, still it would be nice to get the ID of an image generated in a custom field. I found this code, but it only works within some views but not all:
function prefix_get_img_ids($atts) {
global $post;
$images = (array) get_post_meta($post->ID, 'wpcf-picture', false); // cast to array in case there is only one item
$ids = array();
global $wpdb;
foreach($images as $img) {
$query = "SELECT ID FROM {$wpdb->posts} WHERE guid='$img'";
$id = $wpdb->get_var($query);
$ids[] = $id;
}
Well - when you say "it only works within some views but not all" - Can you please share problem URL where you are using above shortcode with the view where the code is not working?
Already got it, just discovered that fields within repeatable groups are actually posts on themeselves, which means they have their own 'id', am I right?