Custom Fields are fields that can holds arbitrary extra information known as meta-data.
4
votes
2answers
728 views
Using media-upload.php to upload mp3 via custom fields
I'm trying to use the Thickbox file upload dialogue with a custom field to allow the user to upload an mp3. What I want to do is to grab the URL of the uploaded mp3 and save it as postmeta (saving the ...
4
votes
1answer
100 views
Prevent reload confirmation after AJAX save
I am saving information in the admin panel via ajax. The problem I'm running in to is the "Are you sure you want to navigate away from this page" popup appear, even though everything has been saved. ...
3
votes
3answers
3k views
Custom Post Types: How-to get rid of editor (-meta box)
I'm questioning how i can get rid of the post-editor (visual + html). I tried to not register post type support, and it still appears (de-registering works fine with every other default meta box on ...
3
votes
2answers
608 views
SELECT max(meta_value) FROM wp_postmeta WHERE meta_key='price'… stops working when value is over 999
Overview: I am not trying to return a post. I simply want the single highest value for a particular meta_value across all posts... just the value itself.
Details: I have added a custom meta_key ...
3
votes
2answers
5k views
Convert jQuery Datepicker Format to SQL Date Format
I set the jQuery Datepicker format to D d.m. displayed as Th 3.3. for a custom meta field that I want to use to sort posts. In SQL, the custom meta field is saved as D d.m.
I would like to display ...
3
votes
3answers
760 views
Does Wordpress have a “Form API”
I do most of my development in Drupal, however I am working on a Wordpress site and I need to make a form. Which got me thinking, is there a Form API for wordpress like there is Drupal? Is there a way ...
3
votes
1answer
2k views
Add filter menu to admin list of posts (of custom type) to filter posts by custom field values
This answer is very close to what I am looking to do, but instead I would like to specify a specific custom field and display a select menu of its available values. Thanks!
3
votes
4answers
2k views
Prevent post from being published if custom fields not filled
I have a custom post type Event that contains a starting and ending date/times custom fields (as metaboxes in the post edit screen).
I would like to make sure that an Event cannot get published (or ...
3
votes
4answers
2k views
Is there a way to set default custom fields when creating a post?
When I'm creating a new post, just after clicking "Add New", when the post editor shows, instead of having to use the dropdown and choose a custom field to use, I'd like to have some default custom ...
3
votes
3answers
4k views
I want to have my custom field use HTML, how do I do that?
I want to have my custom field use HTML, how do I do that in such a way that I can use a rich text editor to view the content?
3
votes
2answers
796 views
How do I paginate search results for custom post types?
I have a Custom Post Type called "cars" that stores several custom fields along with the standard Title/Description fields. I need users to be able to search through the CPT based on the custom fields ...
3
votes
4answers
3k views
Sorting a query by custom field date
EDIT: Reworded the question for more clarity
I'm trying to sort by custom meta box data, which I am converting to a date using the strtotime function, but I'm having some difficulty.
My chief ...
3
votes
3answers
510 views
How to create a mini directory in WordPress?
I'm looking to create a simple directory, something similar but not so powerful as SOBI2 for Joomla.
Is there something like this for Wordpress?
I want to store informations like:
Name
URL
Address ...
3
votes
4answers
3k views
Custom per-page sidebar widgets .. possible?
Let's say I'm doing a site about cars, and in the main content area of a Page (using a certain template), there are a few paragraphs about a particular car.
In the sidebar, are several standard ...
3
votes
2answers
801 views
How to validate custom fields in custom post type?
I wrote a plugin that creates a custom post type with custom fields. To prevent users from entering incorrect information, how can I validate the data?
I assumed that the save_post hook function ...
3
votes
3answers
2k views
Add new “Insert Into Post” button with another function
Problem: Add a hook that automatically adds a short tag to video attachments
when inserted from the Media Library (video) tab:
Update:
This works under the 'Media Library' tab — and doesn't break ...
3
votes
3answers
6k views
Filter by one custom field, order by another?
I have a custom post type "Listing" and I want to get all Listings that have a custom field gateway_value != 'Yes', and order the results by another custom field, location_level1_value. I can get the ...
3
votes
1answer
876 views
How to order adjacent posts (prev / next) by custom field value?
I am using the More Fields and More Types plugins to create a custom post type called product. This custom type is based on the Post type.
One of the fields is named lot which is an integer ...
3
votes
1answer
80 views
Adding another state (spam, reject, approve) to wordpress comments?
i know this might sound a bit weird, but what I'm trying to do is rather simple in mind but may be technically difficult.
I'm running small contests on my wordpress site where I ask users to leave a ...
3
votes
1answer
237 views
Adding Custom Fields for Img in Posts
I'm wondering how I'd be able to set a custom field within my Wordpress posts. I want to have a field available to add an image via the Post dashboard - that has a max width & max height set, I ...
3
votes
2answers
953 views
Problem with serialized arrays in custom meta
I've recently moved my fishkeeping "species profiles" over from a custom DB to a customised WordPress custom post type.
I did this by creating a PHP file which accessed the former database, extracted ...
3
votes
5answers
382 views
How to do a custom bookmarks post type?
Let me first explain what I am wanting to do...
I am wanting to add all my hundreds of website bookmarks that I have now in my browser, into wordpress for the following reasons.
Can search my ...
3
votes
1answer
2k views
Custom Taxonomy Template Post List with Sort Order
I have an interesting problem I am trying to solve. Here is my situations:
I have create a custom post type for "events".
For each event post I require custom fields to be entered for the event ...
3
votes
4answers
1k views
How do I make a custom field choose an image?
I need a way to create a custom field that will let me pick an image from the media gallery. How do I do that?
The custom field should have a button that when clicked will take me to the media ...
3
votes
3answers
937 views
querying with custom meta field with meta_query
How do we get posts where the meta key does not exist in a post.
I have created a meta_key video. and i want to be able to get some posts with WP_Query where custom field video does not exist or is ...
3
votes
3answers
2k views
How do I order by multiple custom fields using wp_query?
I have a rating system where the user can enter a custom field of either "Stars" or "Hearts", but whichever one they choose they have to enter a value of 1 thru 5. Using wp_query, I can successfully ...
3
votes
2answers
1k views
Archive sorting functions by custom fields (front-end)
I want to give the users the ability to sort the posts in the archive by some custom fields that I pre-define.
The end result would be en a tabbed container, and the user will click on the relevant ...
3
votes
2answers
282 views
Is it possible to define the data type of a Custom Field?
I am adding a new "Custom Post Type" named "Seminar". I am defining three custom fields
Location
StartTime
EndTime
StartTime and EndTime are going to store dates (surprise, surprise). I am ...
3
votes
1answer
53 views
How to use multiple query with same meta key
I use these codes to print custom field query.
My custom field key is out_wiki
<?php if( get_post_meta($post->ID, "out_wiki", true) ): ?>
<div class="outlink">
...
3
votes
1answer
101 views
Custom fields PHP foreach loop
In my theme, I am using some PHP to display custom field content. It checks if the fields are empty before displaying the content, because the_meta was showing titles for empty fields.
<div ...
3
votes
2answers
496 views
Custom metabox for menu administration page?
I've been googleing around but failed to find a solution for my need.
I'm using wordpress 3.0 and TwentyEleven theme as default pack.
In the Dashboard -> appearance->menus that allow user can ...
3
votes
2answers
232 views
How to add new custom page or post blocks?
I would like to add custom contents to post, such as price, options and some others, I dont like to use the custom fields, because always i have to select from a drop down menu, I want these options ...
3
votes
4answers
509 views
How I check if the same post slug has not been used before publishing?
For an indie rock agenda I created event posts. With the help of javascript, the custom fields values (bands, places and date info picked in select boxes) are copied as the post title when publishing ...
3
votes
1answer
599 views
Wordpress - custom fields are not restored to previous revisions
I have built several Wordpress websites and noticed that custom fields are not restored to previous revisions. This might cause a problem when using custom fields to store content. Anybody knows how ...
3
votes
1answer
651 views
importing data from non-wordpress mysql db
I have created an import file to get the articles from a non-wordpress db and bring them in as posts in wordpress, I am not sure how to bring over the thumbnail image into my custom field I defined as ...
3
votes
1answer
246 views
Custom Fields and performance
My question : how many custom fields or even taxonomies WordPress can handle without affecting performance?
The reason I ask, is because I started building a custom theme and I might need to have ...
3
votes
1answer
179 views
Custom post type or just use custom fields
I am turning a restaurants website into a wordpress website to allow for the customer to take over content changes. The restaurant has a menu that has categories like Baskets with different types. For ...
3
votes
3answers
247 views
How can I avoid re-inventing the Custom Fields wheel in my Plugin's Metabox?
Here's the scenario:
In my plugin, I want to have a metabox show up on the post / page editor.
I want the metabox to be -exactly- like WordPress' 'Custom Fields' metabox, ( Add another, delete, ...
3
votes
1answer
601 views
Show links to archive pages based on custom field values
I have a recruitment website on which I want to display a list of Job Location links. The job location has already been entered into a custom field for each post so I just want to display a list of ...
3
votes
2answers
125 views
checkbox in post add/edit to add/remove the post from menu
Introduction:
I have created several post type for my theme. To display a post from a post-type I need to go in appearance/menu and then add the post manually.
My Goal:
I want to add two radio ...
3
votes
1answer
140 views
Edit Imported advanced Custom Fields from wordpress Dashboard
I have imported advanced custom fields from one of my other site and now I want to add few more options to those fields but I can't figure out how to do it via Dashboard? I have imported the field ...
3
votes
1answer
120 views
Using get_post_meta with new_to_publish
I'm trying to read the custom fields set by the user when publishing a new post:
function doSomething($post) {
$meta = get_post_meta($post->ID);
error_log("post meta: ".print_r($meta, ...
3
votes
1answer
126 views
Storing meta fields multiple times OR once with multi dimensional array?
I got some options that I expand using a repeater type field. The values I save for each field is already an array so in essence I'm saving a multi dimentional array per option. (See this weekly ...
3
votes
1answer
68 views
Issue with saving custom post type when editor is removed
This one is doing my head in! I'm using this code as the basis for one of my custom post types.
https://github.com/tammyhart/Reusable-Custom-WordPress-Meta-Boxes/blob/master/functions/real-estate.php
...
3
votes
2answers
153 views
Order Posts by Closest Numeric Values
I'm using custom post types to display properties and have a custom price field assigned to each post. On the property page I want to display a list of four similarly priced properties, two less than ...
3
votes
1answer
387 views
With WordPress Importer, why can't I import post meta containing a multi-dimensional array, in which value(s) of that array contain line breaks?
The Question
With WordPress Importer, why can't I import post meta containing a multi-dimensional array, in which value(s) of that array contain line breaks?
Is there a workaround that I can do to ...
3
votes
1answer
173 views
Is there a way to do multiple ordering on a multiple meta_query?
I'm experimenting with searches and multiple criterias and ordering. Let's say we have a real estate site, all posts have 2 custom fields (price and surface), and we want the visitor to be able to ...
3
votes
1answer
166 views
Using wordpress post data as input for google visualisations
I'm trying to use wordpress post data (eg title, link, custom fields) as a data source for google visualisations.
I want to be able to take the wordpress data for all posts and visualise using the ...
3
votes
1answer
348 views
Utilize TinyMCE hyperlink chooser outside of TinyMCE
Is it possible to use the "Insert/edit link" dialog box outside of TinyMCE? For example, if I wanted to add that dialog box to a generic button within a plugin settings form, is it possible to ...
3
votes
4answers
332 views
Using meta query ('meta_query') with a search query ('s')
Trying to build a search that not only searches the defaults (title, content etc) but also a specific custom field.
My current query:
$args = array(
'post_type' => 'post',
's' => $query,
...