How to add to cart without reload page using php code

we are add to cart in e-commerce website without reload page use the php simple code. and get id the cart in session that are the send value through cart button with session. //Get session value $_SESSION[‘cart’]; if(isset($_GET[‘action’]) && $_GET[‘action’]==”add”){ $id=intval($_GET[‘id’]); if(isset($_SESSION[‘cart’][$id])){ $_SESSION[‘cart’][$id][‘quantity’]++; } else{ //Get product id $sql_p=”SELECT * FROM products WHERE id={$id}”; $query_p=mysqli_query($con,$sql_p); … Read more

Add columns to admin orders list in WooCommerce backend

You want to add some columns to your order listing page in the woocommerce admin area. So you if you want to add some columns in the orders Admin list page (in backend) ADDING COLUMNS IN WOOCOMMERCE ADMIN ORDERS LIST In the example below, we add 2 new custom columns, before existing “Total” and “Actions” … Read more

Use ajax without a plugin in wordpress

Plugin code is just… code, it can go in a themes functions.php, or a plugin file, there’s no magical or special difference other than the order they’re loaded . The problem you’re facing is that you’ve tried to put your logic inside the search page. Instead, the code needs to be in functions.php which is always loaded. How … Read more

Get values from an options page from Acf Repeater

we can be used  get field from an options page, however, a second parameter is required to target the options page in using while loop and get filed value show and front and for get display filed <p><?php the_field(‘field_name’, ‘option’); ?></p> <?php $variable = get_field(‘field_name’, ‘option’); // do something with $variable ?> <?php if( have_rows(‘repeater’, … Read more

How to display custom posts month by month?

wp-query be used to show posts month by month, and have it only show the past year <?php $blogtime = date(‘Y’); $prev_limit_year = $blogtime – 1; $prev_month = ”; $prev_year = ”; $args = array( ‘post_type’ => ‘asian’, ‘posts_per_page’ => 20, ‘ignore_sticky_posts’ => 1 ); $postsbymonth = new WP_Query($args); while($postsbymonth->have_posts()) { $postsbymonth->the_post(); if(get_the_time(‘F’) != $prev_month … Read more

How to assign a class “active” to the li click event using jQuery or JavaScript

I am trying to create a menu where a class “active” is assigned to the page whenever it’s selected and loaded and following this using javascript my menu its custom <ul class=”nav navbar-nav”> <li class=”active”><a href=”http://localhost/wp/index.php”>Main</a></li> <li><a href=”http://localhost/wp/news”>News</a></li> <li><a href=”http://localhost/wp/contacts”>Contacts</a></li> </ul> Its working at my end use this <script> jQuery(document).ready(function() { jQuery(“.nav.navbar-nav li”).click(function(){ jQuery(“.nav.navbar-nav li”).removeClass(‘active’); … Read more

How to Create Custom Post Types in WordPress

Custom post types are one of the more useful features in WordPress. In this article, we will show you how to create custom post types in WordPress. Creating custom post type the Easy way you can create manually  custom post type by adding the required code in your theme’s functions.php file // Our custom post type function function create_posttype() { … Read more

Submit a Custom Post Type in WordPress from the Front End

To allow users to submit content, you need to provide a form. The form fields will be used to input details, such as title, post content, tags, categories, featured image, etc. For example, you could create the form as follows: <form method=”post”><p><label for=”stackTitle”><?php _e(‘Enter the Post Title:’, ‘mytextdomain’) ?></label> <input type=”text” name=”stackTitle” id=”stackTitle” /></p> <p> … Read more