Forum Replies Created
-
AuthorPosts
-
pupppetMemberSorry, getting my posts mixed up. I thought the fix was also for the issue I reported here: https://piklist.com/support/topic/file-field-issues/.
But the semi randomly populated content appears to be resolved thanks!
pupppetMemberThanks, I gave it a try but I’m still seeing the same column issue-
Typical field:
<div data-piklist-field-group="ccf4167" data-piklist-field-columns="6" class="piklist-field-column piklist-field-column-last" style="display: block; float: left; width: 49.25%; margin-right: 0px;">...</div>versus a file field:
<div data-piklist-field-group="ccf4167">...</div>
pupppetMemberAs for limiting the number of files a user can upload, you can use the limit validation rule.
I hear ya, I guess I was hoping for something client-side as well for a better use experience (a user shouldn’t see an ‘add’ button if it’s not an option).
pupppetMemberI’m on 0.9.4.25.
pupppetMemberIf we can get that conditional post-relate field bug fixed, there wouldn’t be a need to split them up as you could show/hide whichever post-relate is required. But I could see a situation where you may want multiple post types in the single post-relate field, for example if you have a large number of post types you aren’t necessarily going to want to have a large number of these post-relate fields conditionally showing/hiding, you’re bogging down the client with a lot of near duplicate code (not that it’s the end of the world or anything). ACF5 has a nifty post type dropdown to filter post-types you can include in its equivalent of Piklist’s post-relate field, might be a nice thing to copy.
pupppetMemberpiklist('field', array( 'type' => 'group' ,'field' => 'slideshow' ,'add_more' => true ,'label' => '' ,'description' => '' ,'template' => 'field' ,'fields' => array( array( 'type' => 'file' ,'field' => 'slideshow_image' ,'columns' => 4 ,'scope' => 'post_meta' ,'label' => __('Add File(s)','piklist') ,'description' => __('This is the basic upload field.','piklist') ,'options' => array( 'modal_title' => __('Add File(s)','piklist') ,'button' => __('Add','piklist') ) ) ,array( 'type' => 'text' ,'field' => 'slideshow_link' ,'columns' => 3 ,'attributes' => array( 'class' => 'text' ,'placeholder' => 'http://' ) ) ,array( 'type' => 'textarea' ,'field' => 'slideshow_caption' ,'description' => '' ,'value' => '' ,'columns' => 5 ,'attributes' => array( 'placeholder' => '' ) ) ) ));
pupppetMemberIf I drop the widget in the theme, I see the proper title, it’s only when the widget is loaded from a plugin that I see the title bug.
As an aside, is it possible, or will it ever be possible to have the Piklist widgets display in the widget admin screen in a more traditional manner? It doesn’t make a lot of sense (to the user) when you have individual widgets you can drag into a region, i.e. non-Piklist widgets, and then a single widget that just kinda becomes different types of widgets via the dropdown (I’m still very grateful Piklist has this widget feature be it in this or any state!).
pupppetMemberIt’s created from a plugin, I’ve just pulled your widget examples directly from the demo (example-form.php, example.php). I’m on Linux (CENTOS 5.10).
pupppetMemberSure-

pupppetMemberTo anyone doing the same thing, here’s some working code.
In my meta-box file:
piklist('field', array( 'type' => 'file' ,'field' => 'hero' ,'scope' => 'post_meta' ,'label' => __('Add File(s)') ,'description' => __('') ,'options' => array( 'modal_title' => __('Add File(s)','piklist') ,'button' => __('Add','piklist') ) ));In my theme file:
<?php wp_reset_postdata(); $hero = get_post_meta($post->ID, 'hero'); if ($hero[0] != '') :?> <div id="hero"> <?php $args = array( 'post_type' => 'attachment', 'post_mime_type' => 'image', 'numberposts' => -1, 'include' => $hero ); $attachments = get_posts($args); ?> <?php if ($attachments): ?> <?php foreach ($attachments as $attachment): ?> <?php $alt = get_post_meta($attachment->ID, '_wp_attachment_image_alt', true); $image_title = $attachment->post_title; $caption = $attachment->post_excerpt; $src = wp_get_attachment_url( $attachment->ID , false ); ?> <img src="<?php echo $src; ?>" alt="<?php echo $alt; ?>" /> <?php endforeach; ?> <?php endif; ?> </div> <?php endif; ?>
pupppetMemberAh nevermind, Marcus indirectly answered it in a recent post by describing what ‘true’ does.
pupppetMemberHmm how can I use wp_get_attachment_metadata to get the file data from a specific file field?
$gallery = get_post_meta($post->ID, 'gallery', true);
var_dump( $gallery );Maybe related, should that var_dump not at least display an array? I’m just getting a single number despite multiple files being uploaded.
pupppetMemberThat’s perfect, thank you!
pupppetMemberYup but I’m looking to test if a checkbox value has been checked off, not a radio, so the results will be in an array and I didn’t see an example that pulled values from an array (I could have just missed it, my apologies if so!)-
piklist('field', array( 'type' => 'checkbox' ,'field' => 'theme_regions' ,'label' => __('Active Regions:') ,'description' => __('') ,'value' => '' ,'choices' => array( 'hero' => 'Hero' ,'layout_above' => 'Above Layout' ,'content_above' => 'Above Content' ,'content_below' => 'Below Content' ,'layout_below' => 'Below Layout' ) ));This wordy thing is what I settled on but I figured there’s a better way…
if (($theme_options['theme_regions'] == 'hero') OR (is_array($theme_options['theme_regions']) && (in_array("hero", $theme_options['theme_regions'])))) { ... } -
AuthorPosts