Display Custom Field or Custom Taxonomy in front page /post/product

It depends on the theme you’re using if it has the functionality to show the information. Usually, if you had a custom attribute using default WP, it will show those but for advance custom fields you might need to add the code into your theme. For example, the following code will help you to display … Read more

ACF values to Script with auto refresh

Ok. Solved. PHP function counter_script() { wp_enqueue_script(‘counter’, get_template_directory_uri() . ‘/js/counter.js’); wp_localize_script( ‘counter’, ‘numbers’, array( ‘ajaxurl’ => admin_url( ‘admin-ajax.php’ ) )); } add_action( ‘wp_enqueue_scripts’, ‘counter_script’ ); add_action( ‘wp_ajax_nopriv_numberstotal’, ‘numberstotal’ ); add_action( ‘wp_ajax_numberstotal’, ‘numberstotal’ ); function numberstotal() { global $post; $postargs = array( ‘post_type’ => ‘cpt’, ‘posts_per_page’ => -1 ); $cpt_query = new WP_Query($postargs); if ($cpt_query->have_posts()) : … Read more

create custom shortcode wp and put php code in

the_permalink() echoes the output, and so does the_title() by default. So you should use get_permalink() and get_the_title(): $html .= ‘<h3><a href=”‘ . get_permalink() . ‘”>’ . get_the_title() . ‘</a></h3>’; Or use the_title() with the third parameter set to false to return and not echo the output: $html .= ‘<h3><a href=”‘ . get_permalink() . ‘”>’ . … Read more

Load info from customposttype into template page

You just need to put a query in your template. As an example, I use less conditions. You may add what is necessary later. // prepare arguments $args = array( ‘post_type’ => ‘members’, ‘orderby’ => ‘name’, ‘order’ => ‘ASC’, ‘post_status’ => ‘publish’, ); // create a query based on arguments $query = new WP_Query($args); while … Read more

Help with with my function for wordpress

You can check if the get_field() comes up empty by doing if ( get_field(‘pack_quantity’) ) { //Your code } So something like this should work if you just need to check one of the fields. add_action( ‘woocommerce_single_product_summary’, ‘my_custom_fuction’); function my_custom_fuction() { if ( get_field(‘pack_quantity’) ) { //Change this for which one you need to check … Read more