Remove text after a dot and a colon in Woocommerce product title

Try using following code: add_filter(‘the_title’, ‘mod_product__title’, 10, 2); function mod_product__title($title, $id) { if( is_product() ) { if(preg_match(‘/[^(:|.)]*/’, $title, $matches)){ return trim($matches[0]); }else{ return $title; } } return $title; } Here I’m using regex to match . or : . Regex will match only the first occurrence and return the text before it. Then I’m using … Read more

Modify WordPress Page Title ()

It’s important to read the documentation for filters. The documentation for pre_get_document_title says (emphasis mine): Filters the document title before it is generated. and $title (string) The document title. Default empty string. So when using pre_get_document_title, the title has not been set yet, so when you do this: return $title . ‘ new title’; $title … Read more

how automatically show the image title before the image caption/description in a wordpress gallery?

use this code in single.php $post->ID, ‘post_type’ => ‘attachment’, ‘numberposts’ => -1, ‘orderby’ => ‘title’, ‘order’ => ‘ASC’, ‘post_mime_type’ => ‘image’, ))) { foreach( $images as $image ) { $attachmenturl = wp_get_attachment_url($image->ID); $attachmentimage = wp_get_attachment_image_src( $image->ID, full ); $imageDescription = apply_filters( ‘the_description’ , $image->post_content ); $imageTitle = apply_filters( ‘the_title’ , $image->post_title ); $i++; if (!empty($imageTitle)) … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)