when saveing $meta_box i get Undefined index error
when saveing $meta_box i get Undefined index error
when saveing $meta_box i get Undefined index error
Maybe it can be solved at run-time. wp_get_attachment_image says: Returns an HTML image element representing an attachment file, if there is any, otherwise an empty string. So, if the post meta is set, but an empty string is given, we should delete the post meta. $default=”<img src=”” . get_stylesheet_directory_uri() . ‘/img/team-logo.png” />’; if ( get_post_meta( … Read more
loop through custom post types with meta data
Can you check the argument passed $post_id and see if it is returning the post id else define post globally along with $wpdb like global $wpdb, $post and use $post->ID instead of $post_id.
your main problem is <?php query_posts(‘post_type=case_studies’); if ( have_posts() ) while ( have_posts() ) : the_post(); ?> This means if there are posts, then while there are posts, get from the current post. After processing, it will just keep iterating through the posts. Delete this line and the end while line. Instead, use this <p><?php … Read more
Custom Field: Display only if a specific key is selected outside the loop
How to create a link for wordpress meta datas?
wordress core and importer has no way to know how any of the data is actually being used. The importer will just import everything, if a meta data stopped being used then you will get some not needed stuf in your DB but nothing worse then that. Of course it is very easy to test, … Read more
You can use is_single() in a conditional statement. <?php if( is_single() ){ ?> <ul> <li class=”Source”><a>source:</a></li> <ul class=”Source-Link”> <li><a href=”https://wordpress.stackexchange.com/questions/121060/<?php echo get_post_meta($post->ID,”source-link’, true); ?>” target=”_blank”><?php echo get_post_meta($post->ID, ‘source’, true); ?></a></li> </ul> </li> </ul> <?php }?> Be aware though that this will appear on any single page, meaning a single post page and a single page. … Read more
Based on your comment: when a user clicks to vote, i get the value of that post meta and check if the user id exists in that (using php explode and foreach). If it does not exist then i add the user id in it. there’s no query involved there, so it’s perfectly fine to … Read more