WP Gallery showing captions twice

It looks like your WP Jquery Lightbox plugin is generating these extra captions. Check out the source of the jquery.lightbox.js file: … cut … var s=””; if (title != ”) { s=”<span id=”titleText”>” + title + ‘</span>’; } if (caption != ”) { if (title != ”){ s += ‘<br />’; } s += ‘<span … Read more

Array to modify post titles

Your example code could easily be converted to an array, like this: Updated and improved code for your new example: function manipulate_post_title( $title, $post_id ) { $title_array = array( ‘1153’ => $title . ‘-suffix’, ‘2’ => ‘prefix-‘ . $title, ‘3’ => ‘completely different title’, ); if ( is_single() && isset( $title_array[ $post_id ] ) ) … Read more

If post exists in the database – each time goes on `else`

I suspect that PHP considers the value of $wpdb->get_row(“SELECT * FROM wp_posts WHERE post_title=”” . $title . “””, ‘ARRAY_A’); to be true no matter what (see also this). You’ll have to count the number of rows that are returned Try something like this instead: $query = “SELECT COUNT(*) FROM wp_posts WHERE post_title=”$title””; $count = $wpdb->get_var($query); … Read more

Show post title words one by one [closed]

Create a function in functions.php to see if your title part is in an array of ‘banned’ words: function check_word( $word ) { $blacklist = array(‘the’, ‘it’, ‘and’, …); if ( !in_array( $word, $blacklist ) && strlen( $word ) > 3 ) { return $word; } else { return ”; } } Run your title … Read more

Replace a ‘Title’ tag with a Custom Field

You will want to read up on get_post_meta(). Here is a link to the WP Codex reference for that function. <?php $meta_values = get_post_meta( $post_id, $key, $single ); ?> If you created that custom field with something like Elliot Condon’s ACF plugin, the documentation for the plug-in is also helpful in meeting your exact need. … Read more

Need help with page title (Static front page)

The conditional tag is_front_page() is used to specifically check for a static front page, so you should be able to use that to switch between your title formats <title> <?php if(is_front_page()) { bloginfo(‘name’); } else { wp_title( ‘|’, true, ‘right’ ); }; ?> </title>

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