Forum Replies Created
-
AuthorPosts
-
KevinKeymasterCan you post some more information? If possible please post the radio field code and how you are pulling the data from the system.
Thanks,
Kevin
KevinKeymasterCan you be a little more specific? Does the problem occur when you update a page created before the update or on a newly created page? I just tried your code and it works perfectly when I create a page and fill it out (by the way, outstanding example of how to use our fields for a meta box!)
Please post steps to reproduce and if needed send an export of the page and meta in question to [email protected] and we will help get things sorted out for you.
Thanks,
Kevin
KevinKeymaster@zanedickens – I knew someone was using conditions that way 🙂 In the newest version we added casting to the conditions value for better checking, so now ‘2’ which is a string should now be 2. This way we can use numbers or strings as values now against the keys of choices. Your updated code would look like below, let me know if you have any other questions and thanks again for reporting the issue quickly.
piklist('field', array( 'type' => 'radio' ,'field' => 'header_format' ,'value' => '1' ,'label' => 'Select a Header Ad Format' ,'attributes' => array( 'class' => 'text' ) ,'choices' => array( 1 => '3 Small banners' ,2 => '1 Medium + 1 Small' ,3 => '1 Large' ) )); // SMALL ADVERTS piklist('field', array( 'type' => 'text' ,'field' => 'small_ad_1' ,'description' => __('<strong>Small Advert 1 Image URL</strong><p>Link to the first image file on MFM, e.g. http://mfm.co.za/wp-content/uploads/2014/07/Logo.png</p>') ,'columns' => '8' ,'attributes' => array( 'class' => 'text' ) ,'conditions' => array( array( 'field' => 'header_format' ,'value' => 1 ,'reset' => false ) ) )); piklist('field', array( 'type' => 'text' ,'field' => 'small_ad_1_url' ,'description' => __('<strong>Small Advert 1 Destination URL</strong><p>Link to the first advert destination, not on MFM, e.g. http://google.co.za</p>') ,'columns' => '8' ,'attributes' => array( 'class' => 'text' ) ,'conditions' => array( array( 'field' => 'header_format' ,'value' => 1 ,'reset' => false ) ) )); piklist('field', array( 'type' => 'text' ,'field' => 'small_ad_2' ,'description' => __('<strong>Small Advert 2 Image URL</strong>') ,'columns' => '8' ,'attributes' => array( 'class' => 'text' ) ,'conditions' => array( array( 'field' => 'header_format' ,'value' => 1 ,'reset' => false ) ) )); piklist('field', array( 'type' => 'text' ,'field' => 'small_ad_2_url' ,'description' => __('<strong>Small Advert 2 Destination URL</strong>') ,'columns' => '8' ,'attributes' => array( 'class' => 'text' ) ,'conditions' => array( array( 'field' => 'header_format' ,'value' => 1 ,'reset' => false ) ) )); piklist('field', array( 'type' => 'text' ,'field' => 'small_ad_3' ,'description' => __('<strong>Small Advert 3 Image URL</strong>') ,'columns' => '8' ,'attributes' => array( 'class' => 'text' ) ,'conditions' => array( array( 'field' => 'header_format' ,'value' => 1 ,'reset' => false ) ) )); piklist('field', array( 'type' => 'text' ,'field' => 'small_ad_3_url' ,'description' => __('<strong>Small Advert 3 Destination URL</strong>') ,'columns' => '8' ,'attributes' => array( 'class' => 'text' ) ,'conditions' => array( array( 'field' => 'header_format' ,'value' => 1 ,'reset' => false ) ) )); // MEDIUM ADVERTS piklist('field', array( 'type' => 'text' ,'field' => 'medium_ad_1' ,'description' => __('<strong>Medium Advert 1 Image [435(w) x 60(h)px] URL</strong>') ,'columns' => '8' ,'attributes' => array( 'class' => 'text' ) ,'conditions' => array( array( 'field' => 'header_format' ,'value' => 2 ,'reset' => false ) ) )); piklist('field', array( 'type' => 'text' ,'field' => 'medium_ad_1_url' ,'description' => __('<strong>Medium Advert 1 Destination URL</strong>') ,'columns' => '8' ,'attributes' => array( 'class' => 'text' ) ,'conditions' => array( array( 'field' => 'header_format' ,'value' => 2 ,'reset' => false ) ) )); piklist('field', array( 'type' => 'text' ,'field' => 'medium_ad_2' ,'description' => __('<strong>Medium Advert 2 Image [205(w) x 60(h)px] URL</strong>') ,'columns' => '8' ,'attributes' => array( 'class' => 'text' ) ,'conditions' => array( array( 'field' => 'header_format' ,'value' => 2 ,'reset' => false ) ) )); piklist('field', array( 'type' => 'text' ,'field' => 'medium_ad_2_url' ,'description' => __('<strong>Medium Advert 2 Destination URL</strong>') ,'columns' => '8' ,'attributes' => array( 'class' => 'text' ) ,'conditions' => array( array( 'field' => 'header_format' ,'value' => 2 ,'reset' => false ) ) )); // LARGE ADVERT piklist('field', array( 'type' => 'text' ,'field' => 'large_ad' ,'description' => __('<strong>Large Advert Image [665(w) x 60(h)px] URL</strong>') ,'columns' => '8' ,'attributes' => array( 'class' => 'text' ) ,'conditions' => array( array( 'field' => 'header_format' ,'value' => 3 ,'reset' => false ) ) )); piklist('field', array( 'type' => 'text' ,'field' => 'large_ad_url' ,'description' => __('<strong>Large Advert Destination URL</strong>') ,'columns' => '8' ,'attributes' => array( 'class' => 'text' ) ,'conditions' => array( array( 'field' => 'header_format' ,'value' => 3 ,'reset' => false ) ) ));
KevinKeymasterWe actually have it on the roadmap to roll on_post_status into conditions to allow the display to be modified like this and other ways, but that doesn’t help you now.
However, it’s possible (at least off the top of my head). Use the piklist_pre_render_field filter, which passes in $field. In your function do whatever checks you need and if you want to show the value instead of the field simply set $field[‘display’] = true and that should do the trick.
KevinKeymaster@kattagami-
The next version we are getting ready to release does support widgets in the Customizer. We hope to allow our fields in the customizer in a near future release.
Thanks,
Kevin
KevinKeymaster@kjprince-
This is expected. The Custom Fields Meta Box is core to WordPress and it will allow you to see any meta field not prefixed with _ (which denotes private). Typically when you are creating your own meta boxes you want to remove this from the page by removing ‘custom-fields’ from ‘supports’ in your post type registration.
Thanks,
Kevin
KevinKeymaster@jsperl-
Not a problem, lets walk through this. First you need an ID for the term, there are a variety of ways to get this, for example if you are fetching the terms for a post you can use https://codex.wordpress.org/Function_Reference/wp_get_object_terms or you can just fetch the terms from a taxonomy with https://codex.wordpress.org/Function_Reference/get_terms There are other ways to get the ID depending on where you are and what your working with, I would suggest taking a look over the Codex to see the other methods (Also be sure to check out the loop documentation https://codex.wordpress.org/The_Loop). Now once you have the term id you can get the attachment id (your uploaded image) by using
$the_term = get_term_meta($term->term_id, 'upload_media', true);Now this will return the ID for your attachment and you can now fetch it using something like this https://codex.wordpress.org/Function_Reference/wp_get_attachment_url or any other function that fetches attachments and their data (just depends what your after).
I hope this was helpful, if you have any other questions don’t hesitate to ask.
Thanks,
Kevin
KevinKeymasterThere you go writing piklist features again, thank you sir. I will review and get back to you on getting this into core, since you got to it before I did 😉
Thanks,
Kevin
PS You might want to check out the piklist_assets filter, it has a few upgrades 🙂
KevinKeymasterNot yet, but if you can post your version of WordPress and what OS/Browser you are using we will add it to our current test list.
Thanks,
Kevin
KevinKeymasterJason-
I like the idea, we will add it to our discussions!
Thanks,
Kevin
KevinKeymasterJason-
I actually laughed a little when I read this for no other reason than I got stuck on this myself a few months back. By default get_posts has suppress_filters set to true, so any filters designed to modify the query are not executed. Set suppress_filters to false and things should work as expected.
Thanks,
Kevin
KevinKeymasterThe wpautop is an option for the editor itself and doesn’t affect the output. I think what your looking for is something like this?
<?php echo wpautop(get_post_meta($homeID, 'home-description', true)); ?>Thanks,
Kevin
KevinKeymasterHave you tried the latest 0.9.2 version?
KevinKeymasterJason-
Also if you want to just show the editor without the label/description and make it full width you just need to add the following to your field. It tells piklist to render the field with no markup at all with it (naked).
'template' => 'field'Thanks
Kevin
KevinKeymasterJason-
Agreed, I am waiting on a windows machine to do just that with… we love macs here at Piklist 🙂
Thanks
Kevin
-
AuthorPosts