jaredatch metaboxes on video post formats

You can find out the post format using get_post_format(). So try adding your textarea custom field in a custom metabox library file, and then do the following: if( ‘video’ == get_post_format( $post->ID ) ) { include_once( get_stylesheet_directory_uri() . ‘/path-to-cmb-library/video-metabox-file.php’ ); } This assumes that you’re in The Loop or that you have a WordPress Post … Read more

Display filesize of custom field value

function to handle to show file size i.e. paste this code in functions.php /* * @param string $fileSize Filepath * @param int $digits Digits to display * @return string|bool Size (KB, MB, GB, TB) or boolean */ function getFilesize($fileSize, $digits=2) { $sizes = array(“TB”,”GB”,”MB”,”KB”,”B”); $total = count($sizes); while ($total– && $fileSize > 1024) { $fileSize … Read more

Change Fields of Comments and make them searchable?

Adding additional fields to comments isn’t hard. There are tons of decent tutorials out there (and probably prebuilt plugins too). Google it. Here’s an example: http://wp.smashingmagazine.com/2012/05/08/adding-custom-fields-in-wordpress-comment-form/ As far as I know, searching on tags + categories + comments isn’t possible. I’m confused on why you’d want to search on comments?

Custom field not showing

Because you’re in The Loop, you shouldn’t need to use get_the_ID(). Does this: <div class=”latest”> <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> <div class=”boxes”> <?php echo “<p>”.the_meta().”</p>”; ?> <a href=”https://wordpress.stackexchange.com/questions/109423/<?php echo get_post_meta($post->ID,”promotional_link’, true); ?>”> <?php //var_dump($show); ?> <img src=”<?php echo get_post_meta( $post->ID, ‘promotional_image’, true); ?>” height=”200″ width=”260″> </a> </div><!–boxes–> … Read more

Foreach giving one too many list items, how can I remove the last empty line?

I’ve managed to find the answer to my problem of empty custom fields showing on the page. /** Get Fitness Custom Fields from listing page **/ add_filter( ‘woocommerce_single_product_summary’, ‘something_custom_fields’, 23 ); function something_custom_fields() { //Get picture from post meta or template directory $thumb = get_post_meta($post->ID,’Thumbnail’, true); $thumb = ( !empty( $thumb ) ) ? $thumb … Read more

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