have WP Gallery display the title instead of caption

The quick & dirty way, to set the title as caption, would be to use SQL (untested): UPDATE wp_posts SET post_excerpt = post_title WHERE post_excerpt=”” AND post_type=”attachment” AND post_status=”inherit” AND post_mime_type=”image/jpeg” AND ID = 123 Here we target the jpeg image with ID 123 and empty caption. Note I added the ID = 123 and … Read more

Add a Span Around a Product Title in WooCommerce [closed]

Here is how you do it, First remove woocommerce single title action, and create your own function to handle the title, later add back the action using your newly created function. <?php remove_action(‘woocommerce_single_product_summary’,’woocommerce_template_single_title’,5); add_action(‘woocommerce_single_product_summary’, ‘woocommerce_my_single_title’,5); if ( ! function_exists( ‘woocommerce_my_single_title’ ) ) { function woocommerce_my_single_title() { ?> <h1 itemprop=”name” class=”product_title entry-title”><span><?php the_title(); ?></span></h1> <?php } … Read more

Get wp_title() from page ID into a variable

As you said, wp_title works only for current post, so can be a little tricky save it in a variable for a post that is not the current. However, wp_title works not only for singular post / page / cpt but also for every type of archive. So it’s easy create a custom function that … Read more

Setting title using wp_title filter

Since wp_title() is usually called from the header.php file of your theme, then it runs on every page of your WordPress (frontend usually). So place the filter hook and function in your theme’s functions.php file, and just check if it’s a blog post before you change the title. Something like this: add_filter(‘wp_title’, ‘filter_pagetitle’); function filter_pagetitle($title) … Read more

Automatically add title attribute to links in WordPress

Don’t know if this works but it should, function get_page_title($url){ if( !class_exists( ‘WP_Http’ ) ) include_once( ABSPATH . WPINC. ‘/class-http.php’ ); $request = new WP_Http; $result = $request->request( $url ); if( is_wp_error( $result ) ) return false; if( preg_match(“#<title>(.+)<\/title>#iU”, $result, $t)) { return trim($t[1]); } else { return false; } } add_filter(‘the_content’,’auto_add_title_to_link’); function auto_add_title_to_link($content){ $html … Read more