Forum Replies Created
-
AuthorPosts
-
Long Nguyen
ModeratorHi,
It is possible. But you need to have a basic knowledge about PHP code and WordPress template to get the right way. Run a PHP function in View: https://docs.metabox.io/extensions/mb-views/#running-php-functions
The code to show filter in the View is
<div class="filter-custom-taxonomy"> {% set terms = mb.get_terms( { taxonomy: 'custom-taxonomy' } ) %} {% for term in terms %} <a href="?getby=cat&cat={{ mb.esc_attr( term.slug ) }}"> {{ mb.esc_html( term.name ) }} </a> {% endfor %} </div>remember to change
custom-taxonomyin the filter, the function hooked above to your taxonomy slug. And Type, Location of View set to Post type (Dish) archive.Long Nguyen
ModeratorHi,
To get the subfield value, please follow this documentation https://docs.metabox.io/extensions/meta-box-group/#examples
For example:
$group = rwmb_meta( 'event_details', '', $post_id ); $t1 = $group['event_name']; $t2 = $group['event_start_date'];Long Nguyen
ModeratorHi,
If you want to query posts by date, please use the argument
date_query, read more in the documentation https://developer.wordpress.org/reference/classes/wp_query/#date-parametersAnd refer to this topic https://wordpress.stackexchange.com/questions/52070/how-to-get-posts-published-between-a-date-and-today
Please note that: never use the PHP function in the View, you can run it via the proxy
{% set my_date = mb.date("Y-m-d") %}then
value: my_date,Long Nguyen
ModeratorHi,
You can use the custom admin columns to show the featured image in the listing posts/pages. Follow this documentation https://docs.metabox.io/extensions/mb-admin-columns/#custom-admin-columns
class My_Featured_Image_Columns extends \MBAC\Post { public function columns( $columns ) { $columns = parent::columns( $columns ); $position = 'before'; $target = 'title'; $this->add( $columns, 'featured_image', 'Featured Image', $position, $target ); // Add more if you want return $columns; } public function show( $column, $post_id ) { switch ( $column ) { case 'featured_image': the_post_thumbnail( [40, 40] ); //here break; // More columns } } }With the MB Builder, you can create a field with ID
_thumbnail_idthen show it as an admin column.Long Nguyen
ModeratorHi Alan,
When creating/updating the post in the backend, you can see some default input boxes such as title, content, featured image, date publish ... In the frontend, we call it
post_fields. Please get more details here https://docs.metabox.io/extensions/mb-frontend-submission/#reorder-post-fieldsLong Nguyen
ModeratorHi,
Thanks for your feedback.
Currently, only check the parent taxonomy then the child taxonomies will be displayed. I will inform the development team to explore the possibility.
June 23, 2021 at 7:50 AM in reply to: ✅Show all child posts from parent in CPT single template #29075Long Nguyen
ModeratorHi,
You can put the code to the template file that shows the single post, contact your theme support to ask for the template file.
If you want to use the View, please follow this documentation to know how to run PHP functions in View https://docs.metabox.io/extensions/mb-views/#running-php-functions
Long Nguyen
ModeratorHi,
The function
strtotime()parse the text date time to Unix timestamp. You can use the setting'timestamp' => trueto save the timestamp value to the database. Please get more details on the documentation https://docs.metabox.io/fields/datetime/#settingsLong Nguyen
ModeratorHi,
Here is the filter code that you need to convert and add to the View
<div class="filter-custom-taxonomy"> <?php $terms = get_terms( 'publisher' ); foreach ( $terms as $term ) : ?> <a href="?getby=cat&cat=<?php echo esc_attr( $term->slug ); ?>"> <?php echo esc_html( $term->name ); ?> </a> <?php endforeach; ?> </div>The function to handle the filter should be added to the file functions.php in the theme/child theme folder or Code Snippets plugin
function justread_filter_archive( $query ) { ... } add_action( 'pre_get_posts', 'justread_filter_archive');June 22, 2021 at 6:27 PM in reply to: ✅Meta data being displayed twice (duplicated) on each admin column #29063Long Nguyen
ModeratorHi Giovani,
I'm not able to reproduce this issue on my end. Can you please follow the Debugging Information step here to troubleshoot the issue?
https://support.metabox.io/topic/how-to-create-a-new-topic/June 22, 2021 at 6:18 PM in reply to: Displaying Nested Fields that also include Cloneable Groups #29062Long Nguyen
ModeratorHi,
It's a very complicated group, to show the user info in that group you need more
forloops. Each cloneable group will need 2 loops, one for cloneable, one for the subfields. For example, I have a field groupfunction your_prefix_function_name( $meta_boxes ) { $prefix = ''; $meta_boxes[] = [ 'title' => __( 'Post Meta', 'your-text-domain' ), 'id' => 'post-meta', 'fields' => [ [ 'name' => __( 'Areas', 'your-text-domain' ), 'id' => $prefix . 'areas', 'type' => 'group', 'clone' => true, 'fields' => [ [ 'name' => __( 'Zones', 'your-text-domain' ), 'id' => $prefix . 'zones', 'type' => 'group', 'clone' => true, 'fields' => [ [ 'name' => __( 'Guards', 'your-text-domain' ), 'id' => $prefix . 'guards', 'type' => 'group', 'clone' => true, 'fields' => [ [ 'name' => __( 'Locations', 'your-text-domain' ), 'id' => $prefix . 'locations', 'type' => 'group', 'clone' => true, 'fields' => [ [ 'name' => __( 'User', 'your-text-domain' ), 'id' => $prefix . 'user', 'type' => 'user', 'field_type' => 'select_advanced', 'multiple' => true ], ], ], ], ], ], ], ], ], ], ]; return $meta_boxes; }the view code to get user info is
{% for clone_areas in post.areas %} {% for clone_zones in clone_areas %} {% for zone in clone_zones %} {% for clone_guards in zone %} {% for guard in clone_guards %} {% for clone_locations in guard %} {% for location in clone_locations %} {% for users in location %} {% for user in users %} {{user.display_name}} {% endfor %} {% endfor %} {% endfor %} {% endfor %} {% endfor %} {% endfor %} {% endfor %} {% endfor %} {% endfor %}Hope that makes sense.
June 22, 2021 at 4:13 PM in reply to: Comments are still active although disabled during creation #29060Long Nguyen
ModeratorHi,
To fix this issue, you can enable support Comments for the post type Event, bulk edit imported post and select "Do not allow", screenshot https://www.screencast.com/t/yaOMak8rmN
Then disable Comments support. Let me know how it goes.
June 22, 2021 at 2:38 PM in reply to: How to configure timezone for timestamp in datetime field? #29058Long Nguyen
ModeratorHi vubai,
Thank you for your feedback.
Let me explain this case with the
datetimefield. Thedatetimefield uses our JS library to get the current time of your computer and generate it to the timestamp value then the PHP code helps to save this value to the database.That means the Unix timestamp saved is the "timezone (UTC) + offset". If you use the function
wp_date(), it will display "timezone (UTC) + offset" + offset (timezone in general settings). So, to display the true timezone when using thedatetimefield and the functionwp_date(), you should use this codeecho wp_date( 'F d, Y H:i', $date_time, new DateTimeZone('UTC') );or use the date() function.
Get more details here https://developer.wordpress.org/reference/functions/wp_date/
Long Nguyen
ModeratorHi,
Can you please let me know which wrong with the setting
save_format? The format of the date should bearray( 'name' => esc_html__( 'To date', 'textdomain' ), 'id' => $prefix . 'to_date', 'desc' => esc_html__( 'End of date range', 'textdomain' ), 'type' => 'date', // Date picker options. See here http://api.jqueryui.com/datepicker 'js_options' => array( 'dateFormat' => 'd/m/y', 'changeMonth' => true, 'changeYear' => true, ), 'save_format' => 'Y-m-d', ),Get more details here https://www.w3schools.com/php/func_date_date_format.asp
Long Nguyen
ModeratorHi,
Please refer to this topic if you want to edit custom fields in Quick Edit section https://support.metabox.io/topic/feature-request-add-custom-filds-in-quick-edit/
-
AuthorPosts