Me too , it will be awesome.
Well i don’t know much about contact form 7 , But if it works based on post types you should be able to do this :
You should write a function that runs after theme installation,This function can be written in 2 ways :
1. Insert new contact forms as posts with wp_insert_post() function,
http://codex.wordpress.org/Function_Reference/wp_insert_post
2. Import an XML after theme activation( honestly i don’t know if it’s possible )
Thanks for your reply but it’s not working 🙁
I think i figured out the problem , textcolor plugin should be included in order to use ‘forecolor’ :
http://www.tinymce.com/wiki.php/Plugin:textcolor
But my new question is how to include textcolor plugin to the editor 😀
Oh , you’re right , i tried it only for one variation , since we’re dealing with variable product then field ids should be different.
My guess is you should do it dynamically some how
I mean you should create dynamic custom fields which is not possible with ACF (normally).
What you’re trying to do requires some programming. my solution to this is :
add an html field to variations box like this :
<input type="text" name="myfield_<?php echo $variation_id; ?>">
in this way all fields combine with $variation_id
so they wont be the same any more
And to save the fields you can use save_post
action
http://codex.wordpress.org/Plugin_API/Action_Reference/save_post
I hope this will help
I tried your code with a little bit changes and it’s working,
I think you have missed 'field_groups' => array(YOUR_FIELD_GROUP_ID),
in your acf_form() , Try adding the id of your field group to the acf_form()
<?php
function woocommerce_variation_options_acf_form($loop, $variation_data, $variation) {
add_action('admin_head','acf_form_head',20);
$variation_id = $variation->ID;
?>
<tr><td colspan="2">
<style>
table.data_table td #poststuff { padding: 0; min-width: 1em;}
table.data_table td .postbox { min-width: 1em;}
table.data_table td div.acf_postbox div.field_type-true_false p.label { display: inline; }
table.data_table td div.acf_postbox div.field_type-true_false ul {display: inline-block;}
#variable_product_options .woocommerce_variation table td input[type='checkbox'] { min-width: 1em!important;}
</style>
<?php
acf_form(array(
'post_id' => $variation_id,
'form' => false,
'label_placement' => 'top',
'instruction_placement' => 'label',
'field_groups' => array(28),
'return' => add_query_arg( array( 'post_id' => $post_id, 'updated' => 'true'), get_permalink() ),
));
// var_dump( $variation_id );
?>
<script type="text/javascript">
(function($) {
// setup fields
acf.do_action('append', $('#popup-id'));
})(jQuery);
</script>
</td></tr>
<?php
}
add_action('admin_head','acf_form_head',20);
add_action('woocommerce_product_after_variable_attributes','woocommerce_variation_options_acf_form',99);
/**
In WooCommerce : includes/admin/meta-boxes/views/html-variation-admin.php
*/
do_action( 'woocommerce_product_after_variable_attributes', $loop, $variation_data, $variation ); ?>
try this and use your own field group id instead of ’28’ in 'field_groups' => array(28)
Maybe i can help you if i see your full code
Well you can do such thing
single.php :
<?php
$single_type = get_field("single_type");
if( $single_type == 'type1' ) {
get_template_part("type1");
} else {
get_template_part("type2");
}
?>
You should create type1.php
and type2.php
files in your theme directory.
I hope it is what you want to create.
If you’re using ACF pro then acf_form()
should do it for you.
You may wanna take a look at these links :
http://thestizmedia.com/acf-pro-simple-local-avatars/
http://www.advancedcustomfields.com/resources/acf_form/
Well i didn’t exactly what you’re going to do here , If you wanna ‘export’ a contact form then you can do it with WordPress export tools and import it to any website you want.
And if you wanna show a contact form you can use it’s short code
http://codex.wordpress.org/Shortcode
i have done it before , but i don’t remember exactly how 😀
i think you should set ‘form’ attribute to ‘false’ and then at the end of the page add a custom submit button , like this
<?php
acf_form(array(
'post_id' => $post_id,
'form' => false,
'field_groups' => array(397),
'return' => add_query_arg( array( 'post_id' => $post_id, 'updated' => 'true'), get_permalink() ),
));
acf_form(array(
'post_id' => $post_id,
'form' => false,
'field_groups' => array(397),
'return' => add_query_arg( array( 'post_id' => $post_id, 'updated' => 'true'), get_permalink() ),
));
?>
<input type="submit" value="send">
you should use your own $post_id
and "field_groups"
i hope this will help
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.