custom-fields

WordPress: Looping multiple custom fields from a post

ε祈祈猫儿з 提交于 2019-12-12 05:49:08
问题 I've recently come to a project where using custom fields would be pretty handy. It's for a restaurant and if I can get this right, I could use this bit of code for a few different sections of the site. I'm using the Magic Fields 2 plugin and right now it's awesome, except for when it comes to displaying the fields I've created. Here's where I'm getting pretty lost. For example, I have a post called "Specials" and that has a grouping called "Menu Item" and that group has two fields called

Woocommerce - Add filter to display (or hide) custom checkout field if product ID == #

心已入冬 提交于 2019-12-12 03:16:07
问题 I created a "my_custom_field" textarea, as the default billing_first_name, billing_address, etc..now I'd like to hide this field if product id # is in cart. So, I need to check if productID == #, and so remove my_custom_field from the checkout. Otherwise (maybe better?), I could check if productID == #, and create a custom field for that specific ID (or maybe categories). What do you suggest? 回答1: You can try this, to adapt with your custom field and product IDs add_filter( 'woocommerce

Wordpress custom field - search-results sorted by value

只谈情不闲聊 提交于 2019-12-12 02:54:45
问题 I have a custom field called "rating" with value from 1 to 10. What I want is that you can choose (like click on a button or something like that) to sort the search-results depending on the rating. I've found this code. But the problem is that you can't choose wether to order the post by rating or not. It automatically orders the posts. This is the code which I've copy and paste into the functions.php add_filter('posts_join', 'add_join' ); function add_join($pjoin){ global $wpdb; $pjoin .=

Hide Custom Fields in New Post?

余生颓废 提交于 2019-12-12 01:30:10
问题 I just started out with WordPress and I'm having some problems with the custom fields. Here's the code from functions.php add_post_meta($post_id, 'Post Thumbnail', $post_thumb, true) or update_post_meta($post_id, 'Post Thumbnail', $post_thumb); add_post_meta($post_id, 'Project URL', $url, true) or update_post_meta($post_id, 'Project URL', $url); add_post_meta($post_id, 'Project Thumbnail', $thumb, true) or update_post_meta($post_id, 'Project Thumbnail', $thumb); The problem is that they show

Add field for each file in fine-uploader

旧时模样 提交于 2019-12-12 00:50:53
问题 Trying to implement Fine-Uploader for first time. There's a way I can add a text-field for each file pending uploading? I want the user to comment the content of each file and than save these informations. Thanks for explanations. Dario. 回答1: If you want to add an input text field next to each file represented in the UI (I'm assuming you are using FineUploader mode), you can do the following: Set the autoUpload option to false. This seems obvious, but I thought I should list it anyway. If you

Featured Image from External URL not Working Properly

感情迁移 提交于 2019-12-11 21:27:47
问题 I am trying to use external image as featured image in wordpress. All is done correctly but there is just one problem. The actual external image show only when there is any featured image set via the WP admin. I don't want to set any featured image but still want the featured image from that external URL which is set via a custom field. I hope you guys got it. Here is the code of my content.php and the external featured image is triggered by get_post_meta($post->ID, "external_featured", true)

Custom Field URL Option for Woocommerce Product Thumbnail

会有一股神秘感。 提交于 2019-12-11 21:24:37
问题 Currently I'm using the Woocommerce plugin for affiliate products. I would like to be able to click on the thumbnail on the main page and go directly to amazon, for example. Currently it's setup so that once clicked it goes to the product detail page on my site. From there you can get to the amazon page. However, fewer clicks the better. So I found the hook in the content-product.php page. What I did was wrap the whole thing in a URL and used a custom field to add in the URL. Doesn't work as

Issues facing on controls added through custom field description (javascript)

白昼怎懂夜的黑 提交于 2019-12-11 19:21:26
问题 Below is the stuff which is included in field descirption so, i could have summary row appear. <script type="text/javascript"> var table = AJS.$('<table style="margin-left: 130px;">').append( AJS.$('<tr>').append( "<td style='border: 0px; width: 90px; margin-left: 1px; font-weight: bold; background-color: rgb(204, 255, 255);'><div id='customfield_summary_2:input1'>0</div></td>" ).append( "<td style='border: 0px; width: 90px; margin-left: 1px; font-weight: bold; background-color: rgb(204, 255,

Make a “exclusive” Post using a custom field

风格不统一 提交于 2019-12-11 19:12:12
问题 I'd like a custom field, that can only be assigned to one post at a time. Ideally directly from the Dashboard. Let's say I have a custom field featured post on /post-123 with value true . If I assign featured post: true to post-111 , the value of post-123 's featured post -custom field needs to get the value false or deleted entirely. This means that my custom field can only be assigned to one post. OR A custom field with a specified value can only exist once. Is there a plugin that can do it

CustomFieldManager is not getting the custom field after modifying the custom field name using REST api in jira

一世执手 提交于 2019-12-11 13:19:07
问题 I'm changing the custom field name using the REST api in JIRA. It is changing the custom field name suceessfully. But when I tried to get the custom filed in the code, I'm getting null as the result. String modByWhomCustomFieldName = pluginConfigService.getMUFCustomFieldName(); System.out.println("+++++++++++++++++++In flagCustomField() modByWhomCustomFieldName is:"+modByWhomCustomFieldName); //CustomField modByWhomCustomField = cfManager.getCustomFieldObjectByName("Description Changed By");