I am working on a wocommerce website, and i want to display a tax that will be custom calculated eg: (weight0.660+price=taxquantity) i am using this formula for custom fields calculation. now i want to display the calculated output on user invoice when user checks out. please help me with this
I am using ACF pro plugin to create custom fields and add custom formula.
You need to find the template for the invoice and add
<?php echo get_field('fieldname', $id); ?>
fieldname will be the name of the ACF field and $id will need to be the post id for wherever the field is
Related
Hi i want to add advance custom fields in my wordpress theme. I don't need editor functionality but to provide the users the facility to enter the values to view in the frontend.
basically i want to add the custom fields in my theme just like ACF but i don't want to use the plugin. Is there anything anyone can help me out with this please do.
I'm using ACF plugin right now to add custom fields in my theme.
For example I'm getting the designation from user in the admin panel and our team members custom post type. and showing it on the home page by using this code.
<p><span class="fa fa-user-circle"></span> Designation</strong>:<?php echo the_field( 'designation' ); ?> </p>
I don't want to use ACF plugin to perform this task. I know about the wordpress custom field. The problem with wordpress custom field is I've to select the key every time when I create a post. Here's a sample of what I'm trying to do. I want to add the this in my add new post.
Right now I've to select the key value whenever a new post is created. I want something similar to the image attached in my add new post. Thanks.
You can use native WordPress function(s) to do the same thing. Of course, you lose the extensive ACF features and slick ACF admin panels.
Instead of using ACF's get_field(), you can use get_post_meta(get_the_ID(), 'field', true);
List all items in the meta field 'appartments' like so:
$meta_name = 'appartments';
$fields = get_post_meta( $post->ID, $meta_name, true );
foreach ( $fields as $fieldValue )
{
echo $fieldValue . ' ';
}
i am using CPT UI for custom post type and ACF custom fields.
i have created custom post type (companies) and linked to its custom fields. In admin everything is okay. I want to display this in front end. The user can be enter the company details also. How can i display this in front end ?
<?php
$id = get_the_ID();
$data = get_field('custom_field_name', $id);
echo $data;
?>
Obviously this will need a lot of refinement to look good but that's the basics on how to retrieve data from an ACF field. You may need to var_dump($data); in order to figure out how to get the part you want (if it's not just storing a string). Without more details on what you're doing that's a good an answer as I can give you.
so my problem is with wordpress and custom types fields plugin.
i want to get the title of group you can see at print screen.. and to show in front end. is that possible?
https://prnt.sc/jhuv8z
You can get title of field group by:
<?php echo get_the_title('6098'); ?>
Change the id as per your field group id.
I'm trying to use the the_field(); function in wordpress but did't work
also I tried to use the get_field(); function and same problem what I can do
<?php the_field('contact_form_short_code'); ?>
I am using advanced-custom-fields plugin the free version
the_field('contact_form_short_code') will try to get the field info from the current post in the loop. If you're not currently in a loop it will look to the current page/post.
If you want to reference a post from outside the loop you must specify the post ID, eg: the_field('contact_form_short_code', $post_id)
Hope that helps
Check if your field group location points to your template, taxonomy or custom post type, after that try to use echo to call your field.
Check this link www.advancedcustomfields.com
If you want to display the shortcode (contact_form_short_code) specified in the admin panel via a custom field (ACF), you need to use the do_shortcode(); function.
In your case, the code looks like this:
<?php
//In the admin panel we fill the shortcode of the contact form, for example CF7.
//[contact-form-7 id="1" title="Form"]
$cform = get_field('contact_form_short_code', $post_id);
//Output of shortcode
echo do_shortcode($cform);?>
I have used ACF plugin for creating new fields in my test page.
Firstly I have added a custom field then arrange it to test page. In that particular test page, I am added text for fields & then published.But Which is not showing on my front page. Please help me to find an answer
These are screenshots: 1. http://prntscr.com/g0u29f
2.http://prntscr.com/g0u00d
If you want to display the value you can add <?php the_field('test', get_the_ID()); ?> to your index.php or frontpage.php.
Or if you would just like to retrieve the value and assign it to a variable you could do it like <?php $test = get_the_field('test', get_the_ID(); ?>
the_field() takes the name of the field and the id of the post or page.
the_field() displays the value while get_field() returns the value to be assigned.