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

Changing Title Tag on Shop Archive Page (current solution reverting to Title of First Product in Loop)

Seems like the solution I was looking for was !in_the_loop() Full: add_filter( ‘the_title’, ‘custom_account_endpoint_titles’, 10, 2 ); function custom_account_endpoint_titles( $title ) { if (is_shop() && !in_the_loop() && ! is_admin() && ( ! defined( ‘DOING_AJAX’ ) || ! DOING_AJAX )) { return ‘Shop – Parure.co’; } } Note: the !is_admin and !DOING_AJAX functions are to prevent … Read more

Add text to the first “title”=>get_the_title($post->ID), and shorten

there are many ways to do this, but frankly, this is not a wordpress question it’s a php question. here is your code doing what you asked for $imageAttr = [ “class” => “alignnone size-medium”, “alt” => get_the_title(get_the_ID()), “title” => __(‘hi’, ‘theme-textdomain’) . ‘ ‘ . wp_trim_words(get_the_title(get_the_ID()), 2), ]; $variable = [] is just a … Read more