How to echo a different field if another field is empty?

You might try to replace the foreach( $myCarousel as $carousel ) with: foreach($myCarousel as $carousel){ $myimg = get(‘projectdetails_image’,1,$carousel); if ( !$myimg ) { // use this if you want to show a default image when no image is available in the post $myimg = get_template_directory_uri().’/images/default_banner.jpg’; } if ( $myimg ) { echo “<div class=”item”.( $counter … Read more

Using Magic Fields Image-Uploader with Thumbnails

Magic fields doesn’t necessarily attach images to posts when uploaded via the WP image uploader, and it’s not so simple to get the ID associated with an image. The plugin has its own function to retrieve different sizes: $image_attributes = “w=250&h=150&zc=c&q=90”; // 250x150px, crop to center, quality 90 echo get_image(‘my_field_name’,1,1,1,NULL,$image_attributes); New sizes are generated on-the-fly … Read more

Hide / Show Custom field depending of the page ID (Magic Field 2)

You can remove meta boxes with the remove_meta_box function: function wpse50430_remove_meta_boxes() { // make sure we’re on an admin screen and `post` is set if( !is_admin() && !isset( $_GET[‘post’] ) ) return; if( $_GET[‘post’] == 99 ): // editing page ID 99 remove_meta_box( ‘pageparentdiv’, ‘page’, ‘normal’ ); endif; } add_action( ‘admin_menu’, ‘wpse50430_remove_meta_boxes’ ); To remove … Read more

Inserting data into MagicFields using mysql queries

I had the same problem but I was successful importing from an self produced xml (for the postmeta). <wp:postmeta> <wp:meta_key>telefono</wp:meta_key> <wp:meta_value><![CDATA[$tel_azienda]]></wp:meta_value> </wp:postmeta> The problem was that after that the data were not available to use with MF, I’ve solved it with this mysql query: INSERT IGNORE wp_mf_post_meta (`id`, `group_count`, `field_count`, `post_id`, `field_name`, `order_id`) SELECT `meta_id`, … Read more

tech