Fils de soutien créés au cours des 30 derniers jours : 0
Sujets de forum favoris
This user has no favorite topics.
Sujets de forum créés
|How to get related posts with a dynamic parent post ID||2||4||Il y a 2 mois et 3 semaines|
How to access single fields from a CPT with relationship in php
The issue here is that the use wanted to display custom fields values from their Parent/Child Posts on the frontend
Solution: If it is a custom field value on a related item then you can use our [types field='my-field'][/types] shortcode with the item attribute.
See our documentation below on the item attribute. https://toolset.com/documentation/programmer-reference/views/views-shortcodes/item-attribute/
|2||5||Il y a 2 mois et 3 semaines|
|How to order per dates||2||3||Il y a 3 mois et 1 semaine|
|How to get dates into a dropdown with a given parent ID (product id)||3||10||Il y a 3 mois et 1 semaine|
|Possible to have different field group on WooCommerce Products based on category||2||3||Il y a 3 mois et 1 semaine|
|How to get value of a field from a custom post with parent post reference field||2||7||Il y a 3 mois et 1 semaine|
How to get product title in a view, with a given ID field from it’s relationship
I have a view, where I do show different part for a review. Now I like to add the product title and it's url with a given ID.
The Review custom post type and the products are in a relationship.
If it is one-to-many relationship between "Products" and "Review", you can display the parent "Products" post information with "item" attribute, for example:
|2||3||Il y a 3 mois et 1 semaine|
PHP Warning – disabled for security reasons
Problem: PHP Warning - disabled for security reasons
Warning: getcwd() has been disabled for security reasons in /mnt/disk1/home/chillicyclingksb/public_html/wp-content/plugins/types/vendor/toolset/toolset-common/lib/Twig/src/Loader/FilesystemLoader.php on line 34
Solution: Can you please check with your hosting/server authority if they have block such functions.
|2||3||Il y a 3 mois et 2 semaines|
|How to filter dates in a view||2||7||Il y a 3 mois et 2 semaines|
|How to show all dates, inclusive post title plus some fields||2||14||Il y a 4 mois et 2 semaines|
|How to translate select fields in a CRED post form||3||6||Il y a 5 mois|
|How to show futures dates – each on one line?||2||3||Il y a 6 mois|
How to get the values of a date field?
Problem: I would like to get the values of a repeating date custom field, and output a custom data structure including the formatted dates.
$post_id = 1234; $start_dates = get_post_meta($post_id, 'wpcf-start-tour-date', false);
Note that the Types field slug includes a wpcf- prefix here. This will return an array of date values in Unix timestamp format.
To get a single field value, like the number of tour nights, you can use get_post_meta again like so:
$number_of_tour_nights = get_post_meta($post_id, 'wpcf-number-of-tour-nights, true);
Once you have those values, you can loop over the repeating values and create your own array of information to output. You'll need a way to format dates based on Unix timestamps. You can use PHP's date function for this. For example, to format a date like 2021-08-31 from a Unix timestamp like 1630368000, you can use the date function like so:
$timestamp = 1630368000; $formatted_date = date('Y-m-d', $timestamp);
If you want to calculate a date in the future based on the start date and number of nights, you can use the number of seconds in a day (60 seconds per minute * 60 minutes per hour * 24 hours per day) in your PHP calculations, then format the end date:
$start_date = 1630368000; $number_of_nights = 4; $end_date = $start_date + (60 * 60 * 24 * $number_of_nights); $formatted_end_date = date( 'Y-m-d', $end_date);
|2||6||Il y a 8 mois|
|Repeating date fields in calendar||1||2||
Il y a 8 mois et 1 semaine
|How to "connect" a post type (listing) with "super user" / member?||3||4||Il y a 11 mois et 2 semaines|