Forum Replies Created
-
AuthorPosts
-
Anh Tran
KeymasterHi Sergo,
Please check the browser dev console to see if there's any message from Google Maps API. Usually, Google will tell you exactly why.
Also check the page source to see if the API key is correct. Maybe other plugins enqueue a different JS file using different a API key.
April 23, 2019 at 10:49 AM in reply to: ✅How to use metabox to expire post type automatically after 30 days interval #14234Anh Tran
KeymasterHi,
I think it's a general WordPress question than specifically for Meta Box.
These are the steps I'm thinking of (it requires some coding, though):
- Make a cron job in WordPress.
- In each run, get posts that have a specific status and were published before 30 days.
- Change their status.
Anh Tran
KeymasterIn the latest version of the MB Frontend Submission plugin, I added some code to disable the submit button when it's already clicked (to prevent duplicated submission). You can take it as a sample and write your own code, like this:
function count_favorites() {...} $( 'input[type="radio"]' ).on( 'change', function() { var $submitButton = $( '.rwmb-form-submit' ).children( 'button' ); if ( count_favorites() > 3 ) { $submitButton.prop( 'disabled', true ); } else { $submitButton.prop( 'disabled', false ); } } );April 23, 2019 at 10:21 AM in reply to: Delete all media images linked to post type using front end form #14232Anh Tran
KeymasterPlease try these solutions:
https://wordpress.stackexchange.com/a/109804/2051
https://wordpress.stackexchange.com/a/134916/2051 (note that in this answer, there's a check for post type of the being deleted post).You can also do some search on Google with the term like "wordpress delete attachments when delete post". This is how I found these answers.
Anh Tran
KeymasterHi,
Yes, you can display images as a gallery. Please try this code:
$images = rwmb_meta( 'fotos', ['size' => 'thumbnail'] ); echo '<div class="gallery">'; foreach ( $images as $image ) { echo "<a href='{$image['full_url']}'><img src='{$image['url'}'></a>"; } echo '</div>';April 23, 2019 at 9:05 AM in reply to: change the name of the pdf file name that is displayed on front end #14230Anh Tran
KeymasterHi Brian,
Solution 1: adding a text field for file name.
You can do that by adding a text field into your meta box, or wrap the
file_advancedandtextfield into a group, whatever convenient for you.Then outputting the file using code like below (this is for the case when the file and the text field are not in a group):
$file = rwmb_meta( 'my_file' ); $file = empty( $file ) ? null : reset( $file ); // Just get the first file. $title = rwmb_meta( 'my_file_title' ); if ( is_array( $file ) ) { echo "<a href='{$file['url']}'>{$title}</a>"; }If they're in a group, then you can do like this:
$group = rwmb_meta( 'my_file_group' ); $file_ids = isset( $group['file'] ) ? $group['file'] : null; $file_id = empty( $file_ids ) ? null : reset( $file_id ); $file = RWMB_File_Field::file_info( $file_id ); $title = isset( $group['title'] ) ? $group['title'] : ''; if ( is_array( $file ) ) { echo "<a href='{$file['url']}'>{$title}</a>"; }Solution 2: using a page builder
If you use a page builder, like VC or Beaver Builder, you need to fetch the data of the file to use in the plugin. Meta Box stores attachment ID, not file URL.
A quick solution for that is writing a shortcode to get file URL from the field, like this:
add_shortcode( 'your_file_url', function( $atts ) { $file = rwmb_meta( 'my_file' ); $file = empty( $file ) ? null : reset( $file ); return empty( $file ) ? '' : wp_get_attachment_url( $file ); } );And use shortcode
[your_file_url]in your page builder module to get the file URL.April 19, 2019 at 4:40 PM in reply to: ✅Shortcode in function not working for me after 4.17.0 update #14206Anh Tran
KeymasterHi Brian,
Thanks a lot for your info! I've figured it out and fixed on your site. The fix is also added in the plugin.
Anh Tran
KeymasterHi Dave,
It's normal. Since when you have multiple clones, it's impossible to know which clone is affected by the value of the selected field.
April 17, 2019 at 5:37 PM in reply to: ✅[MB User Profile] Show password meter on registration form #14190Anh Tran
KeymasterAdded
password_strengthparameter in the latest version 1.3.0, which indicates the minimum required password strength (can be very-weak, weak, medium or strong).Anh Tran
KeymasterFixed in the version 1.3.0. I see that we don't need the
user_idparameter at all, since the form is only for the current user.April 17, 2019 at 2:04 PM in reply to: ✅Image field has edit link even when user does not have edit capability #14185April 17, 2019 at 1:43 PM in reply to: ✅How to redirect to the editing mode after adding a post #14183Anh Tran
KeymasterHi, all you need is just adding
edit=trueto the shortcode. Theeditoption is added in version 1.5.0.April 17, 2019 at 1:40 PM in reply to: ✅How to use metabox to expire post type automatically after 30 days interval #14182Anh Tran
KeymasterCan you please explain the "expiry" of a post type? What does that mean?
April 17, 2019 at 1:40 PM in reply to: ✅how to use custom fields of post type in admin as filter using metabox #14181Anh Tran
KeymasterWhat do you mean "as a filter"?
April 17, 2019 at 1:38 PM in reply to: Delete all media images linked to post type using front end form #14180Anh Tran
KeymasterHi, please follow this solution: https://wordpress.stackexchange.com/q/134894/2051
-
AuthorPosts