Move caption in on attachment page

In a theme image.php is the template that displays a single image attachment. There are many similar templates for other attachment types. The Codex has more information about attachment display templates. If you don’t have an image.php template you can quickly make one by making a copy of single.php and renaming it. Then you can … Read more

Change event firing in wordpress

Using transistion_post_status I’m able to retrieve post meta. add_action( ‘transition_post_status’, ‘post_published’, 10, 3 ); function post_published( $new_status, $old_status, $post ) { if ( $old_status != ‘publish’ && $new_status == ‘publish’ ) { $meta = get_post_meta($post->ID); echo ‘<pre>’; var_dump($meta); echo ‘</pre>’; die(); } }

Why is this plugin not working?

$wpdb->custom should be “{$wpdb->prefix}custom” $wpdb->insert( $table, $data, $format ); take three params where 1st is table name. you should avoid wp as its not necessary that prefix will always be wp_ instead use $wpdb->prefix to get table prefix, “{$wpdb->prefix}custom” will output wp_custom (given prefix is wp for your site)

Advanced Custom Fields repeter field expiration

Possibly better than strtotime, as you already know the date format would be date_create_from_format(). Something like: $course_start = date_create_from_format(‘dmY’,$row[‘start_date’]); if ($course_start > date(‘dmY’)){ echo ‘<tr>’; echo ‘<td>’ . $i . ‘</td>’; echo ‘<td>’ . $row[‘start_date’] ; // Check, if “end_date” field is not empty if( $row[‘end_date’]) { echo ‘ – ‘ . $row[‘end_date’] . ‘</td>’; … Read more

Create gallery doesn’t show uploaded images

I finally found that it is caused from the PHP5.5 version, and it’s because of the deprecated function mysql_connect(). I’ve benn able to solve it by changing the file /wp-includes/wp-db.php (line 1142). $this->dbh = mysql_connect( $this->dbhost, $this->dbuser, $this->dbpassword, $new_link, $client_flags ); Change with: $this->dbh = @mysql_connect( $this->dbhost, $this->dbuser, $this->dbpassword, $new_link, $client_flags ); This makes the … Read more

About number of posts in selected category

WP_Query has the following properties you might find handy: $wp_query->current_post – Index of the post currently being displayed. $wp_query->found_posts – The total number of posts found matching the current query parameters