I’m building a function into a shortcode to retrieve information relative to a custom post. For the most part, I can retrieve everything I need with the following, despite (probably) not being the most elegant code and a bit long-winded. function gazdept_shortcode($attr){ $a = shortcode_atts( array( ‘posts’ => 1, ‘issue’ => ”, ‘dept’ => ”, […]
- Tags 'authorpic' => '', 'authorpic2' => '', 'field' => 'slug', 'gazdept_shortcode'); The part where I'm having trouble are the following lines, 'gazetteauthor', 'gazetteauthor2', 'gazetteauthor2email', 'gazetteauthor2pos', 'gazetteauthoremail', 'gazetteauthorpos', 'gazettelinks', 'posts_per_page' => esc_attr($a['posts']), 'tax_query' => array( 'relation' => 'AND', 'terms' => 'deptintro' ), 'terms' => 'issue-'.esc_attr($a['issue']) ), 'terms' => esc_attr($a['dept']) ), ), )); $content = ''; $content .= ''; while($q->have_posts()) : $q->the_post(); $author = get_post_meta( ge, $attr ); $q = new WP_Query(array( 'post_type' => 'gazette', and I've got no other ideas about how to achieve this. Any advice would be very much appreciated., any one post may have multiple values for the same metakey, array( 'taxonomy' => 'gazdept', array( 'taxonomy' => 'gazissue', array( 'taxonomy' => 'gaztype', because while this works to retrieve a single custom field value/metakey pair, dept, despite (probably) not being the most elegant code and a bit long-winded. function gazdept_shortcode($attr){ $a = shortcode_atts( array(, I can retrieve everything I need with the following, I'm building a function into a shortcode to retrieve information relative to a custom post. For the most part, issue, Section, stored in the database as separate records with different a meta_id in wp_postmeta. $links = get_post_meta( get_the_ID(), true); ... $content .= $links; I need to somehow retrieve all values for a particular meta-key within the query and output them as some kind, true); $content .= get_the_content_with_formatting(); $content .= '';, true); $email = get_post_meta( get_the_ID(), true); $email2 = get_post_meta( get_the_ID(), true); $emailph = (! empty($email)? 'Email' : ''); $photo = esc_attr(, true); $emailph2 = (! empty($email2)? 'Email' : ''); $photo2 = esc_a, true); $jobtitle = get_post_meta( get_the_ID(), true); $jobtitle2 = get_post_meta( get_the_ID()