|
Trying to display a picture
Started by: Philippe Ryf
in: Toolset Professional Support
Quick solution available
Problem: I would like to display an image from a custom field using percentage values for height and width.
Solution: The height and width attributes of an image custom field are designed to use pixel units, not percentages. You have these options, all of which require some degree of custom code:
1. Use the types termmeta shortcode to output the entire image with no crop, then apply some custom JavaScript / CSS formatting to crop the image to your own specifications.
2. Create a custom shortcode or shortcodes that will calculate the desired height and width of the image in pixels based on the original image height, width, and your desired percentages. Then use these shortcodes in place of the height and width values in your types termmeta shortcode.
3. Use the save_post hook to programmatically create a cropped image based on the original uploaded image, and save that image into a separate custom field on the taxonomy term.
Relevant Documentation: https://toolset.com/documentation/customizing-sites-using-php/functions/#image
|
|
2 |
5 |
7 years, 3 months ago
Philippe Ryf
|
|
Conditional output between parent and children posts
Started by: Philippe Ryf
in: Toolset Professional Support
Quick solution available
Problem: In wp-admin, I would like to control the display of some fields in my child post type using the value of a field in the parent post type.
Solution: It's not possible to use data from a parent post type to control the field display of a child post type in wp-admin. It is only possible to use the parent custom field data to modify the display of fields in the parent, and the child custom field data to modify the display of the fields in the child post.
Relevant Documentation: https://toolset.com/documentation/user-guides/conditional-html-output-in-views/
|
|
2 |
5 |
7 years, 3 months ago
Philippe Ryf
|
|
Warning: field slug is already being used!
Started by: Javier Félix Hernández Márquez
in: Types Community Support
Quick solution available
|
|
2 |
3 |
7 years, 4 months ago
Javier Félix Hernández Márquez
|
|
What format has Toolset Date Field?
Started by: daveM
in: Types Community Support
Quick solution available
Problem:
I have a Custom Query where I check against a Toolset Date Field in a WP_Query.
Example:
$today = date( 'Y-m-d', strtotime('today') );
'meta_query' => array(
array(
'key' => 'wpcf-tour-date',
'value' => $today,
'compare' => '>=',
'type' => 'DATE',
),
),
It does not return anythign, even if there are fields with values.
What's wrong?
Solution:
Our Dates Field is a Timestamp.
As such, it's a numeric value, not a date format.
The 'type' DATE works with the 'compare' value BETWEEN only if the date is stored at the format YYYY-MM-DD and tested with this format.
And our Date Field is not storing it in this format but in a simple timestamp format.
The easiest solution is to compare as a NUMERIC value as that is what Toolset stores for the Date Fields.
Relevant Documentation:
https://toolset.com/forums/topic/filter-only-future-posts-in-wp_query-by-custom-date-field/#post-547754
|
|
2 |
3 |
7 years, 4 months ago
daveM
|