Articles of custom field

Can serialized arrays in DB be matched against serialized arrays with meta_query?

Say I have an array of checkbox choices associated with a post (a custom field) stored in the database in serialized form. On my site, I present users with the same checkboxes and let them make their choices to “filter” out posts according to their choices. If as little as one of their choices matches […]

How to make custom comment fields required and message field not required

I have a comment form that has name, email, brief, detailed and rating fields. The name, email, brief and rating need to be required, but the latter two are custom fields and I can only make them required through Javascript, but want to add proper WordPress/PHP validation to those fields. The detailed field is actually […]

Let's Create Custom Field Template Documentation

I’ve been using the Custom Field Template plugin for a while now, and I really like it. It’s fantastic for adding quick custom field meta boxes in the wordpress back end. It handles TinyMCE, file uploads, repeating fields, date picker, etc. For really advanced stuff I do custom coding, but nothing beats rapid development with […]

How can I combine this php statement to get the results of multiple variable inputs?

This is my query, it shows the posts that have meta_key as extra1 and meta_value as test <?php $customkey1 = ‘extra1’; ?> <?php $customvalue1 = ‘test’; ?> <?php query_posts(‘meta_key=’ . $customkey1 . ‘&meta_value=’ . $customvalue1); ?> <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> <?php the_title(); ?> <?php endwhile; ?> […]

Edit multiple custom post types while saving a new or edited post

I have a custom post type with some custom fields in it. Now what i want to do is when i save a new OR edit an existing post in that post type, is to change custom fields from all the other posts of that custom post type. I’m familiar with the update_post_meta, but i […]

How to Resize the Custom Post Images?

am Having Custom Field named as thumb.i want to show the images using these custom fields.i want to be fix the image size. My code is <img class=”thumb” src=”<?php echo get_post_meta($post->ID, ‘thumb’, true) ?>” alt=”<?php the_title(); ?>” /> i tried timthumb also like this <img class=”thumb” timthumb.php?src=”<?php echo get_post_meta($post->ID, ‘thumb’, true) ?>”&q=100 alt=”<?php the_title(); ?>” […]

What's the best way to implement custom widgets on a per post basis?

I’m creating a category called “Falculty” where each post is a member of my client’s staff. Each post includes a biography and photo gallery of that staff member. My client would like to be able to add Twitter, Facebook, and Youtube links/feeds to their individual profiles. What would be the best way to handle this […]

Order custom posts by a date metabox

I have a custom metabox, where I store the date in plain text like this: dd/mm/yyand now I need to order the posts by that date.The custom field is called event_informations_date <?php $args = array( ‘post_type’ => ‘Event’,’posts_per_page’ => 1000 ); $loop = new WP_Query( $args ); ?> <?php while ( $loop->have_posts() ) : $loop->the_post(); […]

How do i get the attached images with custom value checked?

I have added a custom field to the image attachement. When this custom field is checked the image will be part of a carousel on the home page. Now i am able to get the custom field to work and save the selected value, but how do i query the database so only the post […]

Convert attachment ID into url?

I’m using the plugin advanced custom fields to create custom fields to create a relationship between two pages. The code below is looking at the relationship field and grabbing the page title and company logo of the linked page. The only problem is that instead of outputting the image url (so it displays the image), […]