Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I need help adding VIEW and ADD button into my Woocommerce Shop page. Do you have any plugins or codes that I can add into my functions.php?
You can try this code to add add to cart and view button in shop page
//// to add cart buttton
function add_cart_to_shop () {
add_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_add_to_cart', 10 );
}
add_action( 'after_setup_theme', 'add_cart_to_shop' );
//// to add view buttton
function add_view_to_shop() {
echo 'View';
}
add_action( 'woocommerce_after_shop_loop_item', 'add_view_to_shop', 8 );
Try this then let me know the result.
You need css code to design it yourself.
Thanks
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
on woocommerce site I would like when the product has 0 qty to show the add to cart button disabled and not disappeared.
https://woocommerce.github.io/code-reference/classes/WC-Product.html#method_get_stock_quantity
You can use the get_stock_quantity method of WC_Product to check the available count of your product.
global $product;
if ( $product && $product->get_stock_quantity() > 0 ) {
// your current button
} else {
// disabled button
}
For loop, you can use the hooks from this template and for a single page from these.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
Good morning
I am trying to create a custom add to cart button that only works when the customer answers a question correctly.
if ( /* Your condition ... */ ) {
add_filter( 'woocommerce_product_single_add_to_cart_text', 'woocommerce_custom_single_add_to_cart_text' );
function woocommerce_custom_single_add_to_cart_text() {
return __( 'Your text...', 'woocommerce' );
}
}
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I still can't get my head around hooks but I assume a hook might do what I need.
Currently using WP Show Posts to short code into a home page, that uses WPBakery as the page builder.
WP Show Posts can pull in post header, date, excerpt and button link.
I want to hook the date (post publish date) to the post Advanced Custom Field i.e. event date. this is the development site https://dev.itassetalliance.com/
Webinars category post. changing default wordpress the_date() to
Yes you should be able to use get_the_date filter, more here. Below is a quick example of how you might do this:
<?php
// hook into get_the_date filter
add_filter('get_the_date', function ($post_date) {
// get event date
$event_date = get_field('event_date');
// may need to use some other check here
// but this if we have $event_date return
// it in place of the default post date
if ($event_date) {
return $event_date;
}
// if we did not return an event date
// then return the default date
return $post_date;
});
?>
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I've made websites from scratch using bootstrap and websites using wordpress but now I want to make an e-commerce website using wordpress and woocommerce but I also want to utilise bootrap's commands for responsiveness. How can I integrate bootstrap into my wordpress theme that I am creating?
In your theme/child-theme functions.php file you should enqueue your css and javascript files.
For example:
function theme_enqueue_styles() {
wp_enqueue_style( 'bootstrap-theme-style', '/wp-content/themes/' . get_stylesheet() . '/assets/css/bootstrap.min.css' );
wp_enqueue_script( 'bootstrap-min-script', '/wp-content/themes/' . get_stylesheet() . '/assets/js/bootstrap.min.js', array(), true );
}
add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' );
Just add the bootstrap styles and javascript to the theme header and then use the responsive classes described in:
http://getbootstrap.com/css/#responsive-utilities
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I have a form in my Wordpress theme and I want to create custom post when I submit that form and to fill that custom post with some data from the form. What would it be? A plugin or maybe just several strings of code in functions.php? Kindly show me proper directions.
Please go to this link "insert post from frontend"
Hope the above tutorial will full fill your requirement also you can use "frontier-post" plugin to do your task.
Easiest way to do it is create a Page Template with the code to capture the form's post data. You'll also need wp_insert_post.
<?php
/**
* Template Name: My Custom Form Page
**/
?>
<?php
if(isset($_POST['my_form'])):
// do something with the data
$post = array();
$post['post_title'] = $_POST['user_title'];
$post['post_content'] = $_POST['user_content']);
$post['post_type'] = 'my_custom_post_type';
$postID = wp_insert_post($post);
endif;
// continue to template with form
?>