Getting the Image Title (not the post title)

The specific bit I’m having difficulty with: <?php the_title( $attachment_id ); ?> the_title() doesn’t have a post ID parameter, and the first parameter is actually a text/markup to prepend to the title. And note that attachments like images in the WordPress media library have their own posts, where the type (i.e. post_type) is attachment. the_title() … Read more

Auto Generate Post Title from 2 Custom Fields

You can use the wordpress save_post action to update the title using the custom fields as you like. Here is the simple example I have used myself – add_action( ‘save_post’, ‘custom_post_type_title’ ); function custom_post_type_title ( $post_id ) { global $wpdb; if ( get_post_type( $post_id ) == ‘job-updates’) { $terms = get_field(‘job’, $post_id); // taxonomy fields … Read more

Add string to page title if post in specific category

If you meant the title in the title tag as in <title>here</title> on single post pages, then you might want to use the single_post_title filter to prepend the string in question to the page title. E.g. add_filter( ‘single_post_title’, ‘recipe_single_post_title’, 10, 2 ); function recipe_single_post_title( $title, $post ) { if ( in_category( ‘recipes’, $post ) ) … Read more

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