Questions tagged [custom-field]
Custom Fields are fields that can hold arbitrary extra information known as meta-data.
3,690
questions
3
votes
1
answer
628
views
Change post format using custom field
I'm creating a theme using the CF Post Formats plugin. But I've run into some trouble I don't know how to solve. Here's what I want to be able to do:
Create a new standard-format post
Enter a url ...
0
votes
1
answer
864
views
Multi Photo Upload with Caption on Front End for Custom Post Type
I have a page template that allows users to create posts (for a custom post type) on the front end and upload (multiple) images. Currently it works fine but I would like to enhance it by adding the ...
1
vote
1
answer
925
views
Include woocommerce custom field value in front-end search result
currently the search result only showing all the woocommerce default product field (product title, category, tag, .etc).
I've add a new custom field inside the woocommerce product using this code ...
1
vote
0
answers
32
views
+50
How to add a custom field to the comments "Quick Edit" screen?
How do you add a custom field to the comments "Quick Edit" screen?
The code below only shows on the posts quick edit screen:
function tips_quick_edit_fields( $column, $post_type ) {
?>
...
1
vote
1
answer
865
views
Firing schema via code in functions.php doesn't work
I've been banging my head against the wall trying to get schema figured out, so if anyone can help me, I'd appreciate it greatly.
I'm trying to manually add my schema via custom fields, and then ...
1
vote
1
answer
640
views
Saving Custom Field Data before Publish
When creating a page or a post WordPress lets the content (title, body, featured image) be saved when using Ctrl + S. The Custom Fields do not save in the same way (in this case I'm using Advanced ...
0
votes
1
answer
638
views
ACF - Retrieve custom taxonomy from a relationship field
I have a custom post type, called prognosis with 3 custom taxonomies, Country, Competition, and Sport, I've also added a few ACF custom fields. I have another custom post type called analysis with an ...
1
vote
1
answer
1k
views
How to add a user custom field into Woocommerce emails?
How do you add a user custom field into Woocommerce emails?
This is my code so far in functions.php
add_filter( 'woocommerce_email_order_meta_fields', 'custom_woocommerce_email_order_meta_fields', 10, ...
0
votes
0
answers
14
views
If possible a field ID transfom in a Custom Field?
I have a field with a ID, I need that this field will be or will apppear in Custom Field. If possible with a function copy this field and replicate in a Custom Field.
Thank you
1
vote
1
answer
632
views
How to display custom option field in woocommerce orders in admin panel?
Actually this question has already answered as i already checked but i am unable to comment on that question as i am using the same code but in my scenario i am using options field and value is not ...
0
votes
0
answers
32
views
WP_Query sort by ACF date field (newest first) with blank dates first
I have a custom date field that is optional. If a date is not provided, the item should be first in the items returned by WP_Query. Example:
1st: entry with no date
2nd: entry with date 1 March 2023
...
0
votes
1
answer
639
views
Ordering Post by Meta Key (Not Working)
So I've read all the stack exchange posts on this, and I feel like what I have, based on what I've read, should be working. I'm a little confused as to why it isn't.
$args = array(
'post_type' =&...
0
votes
1
answer
648
views
automatically add custom fields to post title
im going to add custom fields to post title ,
my post title is "Marroon Five" and my custom fields is "release-year" and with value "2017" .
so how to make the output : Marroon Five (2017)
this is ...
1
vote
1
answer
2k
views
How to create a custom post type with additional fields?
Beginner's question:
Looking for example how to create a custom post type with additional elements. What I mean is: in my code I have a basic stuff like 'title', 'editor' ... but I need also for ...
0
votes
1
answer
2k
views
Change blog post title on main blog page
Looking to create a custom field to change the titles shown on the blog archive page without effecting them on the actual posts. (The purpose of this is to have shorter titles when viewing all the ...
0
votes
2
answers
1k
views
Updating custom fields with external data
For our articles on our WordPress site, we would like to display article analytics that are collected weekly for each manuscript. We have these native custom fields for each post:
Article Views
PDF ...
0
votes
1
answer
1k
views
Populate custom post type/custom fields from an external database
I have a custom MySQL DB(same host/different domain) with a lot of vehicle information.
What we want to do is populate a custom post type and custom fields with this data so that it's SEO friendly in ...
0
votes
1
answer
714
views
adding autosave feature to custom fields
Does anyone know how to add autosave feature for advanced custom fields or add acf to the autosave event.
I searched about it but I didn't find any solution.
thank you
0
votes
2
answers
890
views
divide custom field values in div every two values
i have this html mark-up to sort some data
<div class="row">
<div class="col-xs-2">
<img src="images/member-schools/ms1.jpg" class="img-responsive">
</div>
<div class="...
0
votes
0
answers
20
views
Query order by a numeric ACF field
I created a query for the custom post type of "departments" the query gets me every department with ACF field "type_of_cetifecate" = "bach" and with a certain category id,...
0
votes
3
answers
1k
views
Query posts by multiple custom fields
I have made two dropdown list which is a custom fields.
Custom Field 1 :- industry
Values of Custom Field 1 :- financial_services,ecommerce,insurances, etc.
Custom Field 2 :- primary_functionality
...
2
votes
1
answer
644
views
Ordering Posts Type A by Custom Fields of related Post Type B
I'm not sure if this is even possible (also posted to ACF forum https://support.advancedcustomfields.com/forums/topic/ordering-by-custom-field-of-relationship-field-object/#post-62454)
I have two ...
0
votes
1
answer
644
views
ACF - Get unique values of array
I need to get unique values of array to use in a filter. This is my code
<?php
$newsArgs = array(
'post_type' => 'sistemas-sanitarios',
'...
2
votes
2
answers
5k
views
How can update custom meta for all posts
How can update custom meta (likes) for all posts that have this meta?
If i used something like this:
update_post_meta( $post_id, "likes", 1 );
it's required to add the post id that I need to update ...
0
votes
1
answer
2k
views
Advanced search form with multiple custom fields
I'm working in a site that allows to search for lawsuits about
medical malpractice, the client wants to have a search form almost equal to the one in this site:
http://psychcrime.org/database/
All ...
0
votes
2
answers
33
views
How to include custom fields in wordpress search
As you know WordPress search only look at the post titles and contents, but I want the search to include also a custom field. Let me explain more:
Consider a movie post with the title "Fast Five&...
0
votes
0
answers
12
views
Custom Admin Menu Report for Specific User ID
I've been thinking for generating a custom revenue report for each user ID with an 'author' role monthly, which would be displayed on the backend.
All my online users must be able to view their own ...
0
votes
0
answers
18
views
Get API from external source and save in cutom post type
I am new to this API thing,
I have an external API that contains 345 products. Product fields are feature images, product descriptions, and a few meta fields. I know how to create CPTs and meta fields;...
0
votes
1
answer
42
views
Set post status to draft after validating post meta values in save_post hook
I have some custom meta values to a custom post type ('event'). The custom post type is displayed in the admin and the custom meta fields are appearing fine. I am using save_post_{$post->post_type} ...
0
votes
1
answer
10
views
Best way for managing images of ads banners
I started building a custom theme and I have a lot of ads banner image on different pages of the site. But my concern is about slowing down the site's loading speed.
What is the best way to display ...
0
votes
1
answer
22
views
Best performance for use Custom Field in WP
I started building a custom theme and I might need to have around 10 to 20 custom fields for posts and I need to 30 custom fields for theme options and image ads banner, and thinking if this will ...
0
votes
1
answer
789
views
Get custom field from other post in carousel
Im using a plugin called wp carousel to display custom post types in a carousel in the footer in the singular view of posts. By default the plugin gets the featured image and the title of the post, ...
0
votes
1
answer
691
views
How to Save settings of custom tab product page in admin side in a database?
I have following code :
<tr>
<th><?php _e('Custom Stock Message'); ?></th>...
1
vote
1
answer
1k
views
filter custom post in rest api with custom function
i have 3 custom post type : artists, songs, videos
songs and videos have a meta that sort artist id of songs or videos
filter in rest api couldn't return filtered post by artist id custom meta
so i ...
0
votes
0
answers
10
views
Crop custom image size vs actual size
I need to use specific image size with add_image_size to true using ACF image field and wp_get_attachment_image
From this side, my image is displayed well and resizes well in 175*200.
I would like to ...
0
votes
1
answer
752
views
Sort posts by custom fields with empty values
I'm trying to list a few post sorting by a custom field value ("space-comments"). It's working very well, however, when the custom field is empty the loop don't get this post.
Any idea to fix it? ...
0
votes
1
answer
797
views
wordpress simple post multi rating with post_meta and user_meta
I am trying to create a multi criteria post rating function with simple form and post_meta and user meta.
The Goal
when users submits their ratings 2 things should happen:
1.the ratings is stored ...
0
votes
0
answers
52
views
Extend search query to search meta keys values based on search string
I want to create an autocomplete AJAX search and I'm trying to have it where when the user starts typing, the list populates titles matching that search string.
My issue is in the WP_query, because I ...
0
votes
1
answer
16
views
Modal pop-up HTML code works on other sites or HTML viewers but not in the custom HTML block within a wordpress page?
I'm not the best at coding, but I've managed to create this html code of a modal pop-up which includes CSS, Javascript, and html... it works in an html viewer or anywhere else except the wordpress ...
0
votes
0
answers
20
views
ACF in radio button cf7
Good morning, I hope I am in the right place.
A customer has asked me to create contact forms with radio choices that have values taken from ACF (Advanced Custom Field)
I enclose a screnn and write an ...
0
votes
2
answers
859
views
How to display custom post type ordered by a custom field date
I have a custom post type for a timeline activities.
each post of them has a custom field type of DATE. field name :activity-date
I'm using TYPES plugin for Custom Post Type and Custom Fields
I ...
0
votes
1
answer
664
views
Undefined Variable (Displaying image via custom field)
I'm getting "an undefined variable in line 6" while trying to display an image from a custom field. It's pulling the name/link of file; but not image. Here is my code
<?php query_posts( 'cat=36&...
0
votes
1
answer
1k
views
How to add custom fields to images for image source text and URL
How do I add two custom fields to images to allow me to put in text for source name example: Shutterstock
and then link that text to the second custom field URL field example: shutterstock.com
Some ...
0
votes
0
answers
15
views
Multiple permalinks for a single post from custom field
I'm looking for a way to add additional slugs for regular posts, so that a single post can be viewed from multiple urls.
Example: the canonical post url would be: website.com/foo-bar but I want ...
1
vote
2
answers
3k
views
How to use thumbnail size of image if I'm only using src to get image
I have a custom field for an image, and using it this way:
<?php $item_img = get_sub_field('image'); ?>
<img src="<?php echo $item_img ?>" />
But I want to use the thumbnail ...
2
votes
1
answer
4k
views
Saving custom image meta fields
I have currently added a custom meta field to upload a media file (image). I can successfully add the upload button to display and it works but I'm having problems saving the field when updating the ...
0
votes
1
answer
1k
views
new WP_query using custom fields
I am trying to query child posts from two parents (that part is working fine),
... but now I want to exclude posts that have a meta_key of 'feature' with a meta_value of '1'
Using the Codex ...
0
votes
1
answer
146
views
Updating a custom post status after an expiry date rather than trashing it
I have set up a custom post type of featured products. Within that post type I have a custom date field for an expiry date. Currently when the date expires, the post gets moved to the Trash. I'm ...
0
votes
1
answer
688
views
Where is get_post_meta value located?
I'm working on a wordpress website created quite long ago. In the header file I see the following code:
<?php
query_posts("page_id=63");
while ( have_posts() ) : the_post()
?>
<?php echo ...
0
votes
1
answer
690
views
How to add meta fields to custom taxonomy add/edit page?
I have a custom taxonomy 'issue'. I tried to add some meta fields to the add/edit issue pages in the dashboard using the method explained by Ohad Raz (https://en.bainternet.info/wordpress-taxonomies-...