Articles of custom field

How to get multiple checkboxes in one meta field

I can manage to show one checkbox using woocommerce products custom fields However, I need to show multiple values from multiple checkboxes in my admin area. I have the following code: <input type=”checkbox” name=”myoption[option_one]” value=”1″<?php checked( isset( $options[‘option_one’] ) ); ?> /> <input type=”checkbox” name=”myoption[option_two]” value=”1″<?php checked( isset( $options[‘option_two’] ) ); ?> /> Now how […]

Price comparison table based on Custom Post Type?

I have created a review site where clients can rate their hosting providers based on various factors, however since the launch, many have asked if it would be possible to create a price comparison table so they could look for provider’s in their price range. I believe the best way to do this will be […]

How do I show my <p> containing my custom field ONLY if there is a set value on that custom field?

I am using the Custom Fields Plugin and have 2 custom fields assigned to my “products” custom post type. Field 1. Price Field 2 Discount Price So this is my code: <div class=”wrapper”> <p>Price: <?php the_field(‘price’); ?></p> </div> “Now this is what I am trying to achieve hypothetically” <div class=”wrapper”> <?php if (the_field(‘discount’); )is set: […]

Enable a short code in the custom meta field

I was wondering if there is a filter that allows me to enable short codes to work inside the custom meta fields in my posts. I know the following code enables it in widgets: add_filter(‘widget_text’, ‘do_shortcode’); And where would I have to put a code? My theme has shortcodes.php also meta-boxes.php Thanks in advance.

Show custom field on attachment page?

I use this code to show custom field value outside loop on post page (single.php): <?php echo get_custom_field(‘my_custom_field’); ?> But, that is not working on attachment page (image.php). How to show post custom field on attachment page (image.php template)?

Filtered by a custom field, ordered by another

I am trying to loop custom post-types, filtered by a custom field artist-status => invited and ordered by another custom field last-name alphabetically. Here is what I managed to write, and it doesn’t work as I need: $args = array( ‘post_type’ => ‘artist’, ‘posts_per_page’ => -1, ‘meta_key’ => ‘artist-status’, ‘meta_value’ => ‘invited’ ‘orderby’ => ‘meta_value_num’, […]

How to query using a combination of custom_field values?

I need to get posts pertaining to a given category, AND : have the event_start_date (custom field) greater or equal than today’s date OR have a event_end date (custom field) greater or equal than today (if their event_start_date date is less than today’s date The results need to be order using the custom_start field. I’m […]

Upload & include specific JavaScript files for posts?

I need to include specific Javascript files on specific posts. This will be done in pretty much every post and each file is unlikely to be included in more than one post. I know I could just upload the files via FTP and put a <script> tag at the bottom of the post, but I […]

Custom Fields Question

I’m new to wordpress and I am trying to understand these custom fields. I read the wordpress codex page refering to custom fields but I have some questions. I take for example my site. I created a custom field named “country_flag”. I want this custom field to store for every post a link to a […]

Let user to add input fields on theme option page

I’m creating a Theme Option page for my own wordpress theme and I’ve been trying to create something like this on my option page It means my user(admin) can add any number of input fields (in this image, they’re drop down elements) I need to add this feature as a inbuilt option page, so plugins […]