Return product description

If you want to get the product description instead of product terms descriptions you can do this. protected function GetDescription ($ProductID) { return get_post_field(‘post_content’, $ProductID); } This will return the content field by the id, if no content exists it will return an empty string.

wp-mail attachment is not sent for no reason?

I changed the code to this and it worked ! Don’t know why I should do this and this is very odd but whatever. function send_mail_to_admin($orderId , $attachment_img){ $attachment_img = str_replace(“https://seabou.com/wp-content” , “” , $attachment_img); $attachment_img = array( WP_CONTENT_DIR . $attachment_img ); $headers = array(‘Content-Type: text/html; charset=UTF-8′,’From: انجمن آبزیان <[email protected]>’); $body = “<html><body> <b style=”font-size:14px;direction:rtl;text-align:center;”>یک … Read more

Automatic excerpt is not shown with the_excerpt() command

By default, the_excerpt(), doesn’t uses the post/page content wysiwyg, it has its own textarea, that by default is not visible, you need to enable it first via screen options. After you checked this checkbox you can scroll down to the bottom of the post/page and see a new textarea, this is the excerpt. If you … Read more

the_posts_pagination() not working in wpquery

Thanks to @Buttered_Toast i’ve managed to get it work by changing: <?php the_posts_pagination( array( ‘mid_size’ => 2, ‘prev_text’ => __( ‘Back’, ‘textdomain’ ), ‘next_text’ => __( ‘Onward’, ‘textdomain’ ), ) ); ?> to: <?php echo paginate_links( array( ‘base’ => str_replace( 999999999, ‘%#%’, esc_url( get_pagenum_link( 999999999 ) ) ), ‘total’ => $postslist->max_num_pages, ‘current’ => max( 1, … Read more

require_once() if a product in woocommerce contains a tag [closed]

has_term() is a template function therefore it does not work if you use it straight in functions.php which is loaded well before knowing if the current object is a product page. So if you use it in functions.php you could do: add_action(‘template_redirect’,’my_inclusion_function’); function my_inclusion_function(){ if(is_product() && has_term(‘xyz’, ‘product_tag’)){ require_once( WP_CONTENT_DIR.’/path/file.php’); } } is_product() checks if … Read more

Use value from Ajax call in PHP function

The main problem with what you’re attempting is that variables do not persist across requests. If you set a variable on the AJAX request, that variable will not be set on the request to reload the page. The other problem is the way you’re referring to this as an “Example of function to change language”: … Read more