Inserting HTML tag with ACF into shortcode

You have to use do_shortcode() to execute shortcodes in your string Full code should be like that <?php function my_shortcode( $atts ) { $atts = shortcode_atts( array( ‘post_id’ => ”, // Default value. ), $atts ); $output=”https://wordpress.stackexchange.com/questions/291524/[acf field=”image” post_id=”” . $atts[‘post_id’] . ‘”]’; $output = do_shortcode( $output ); $output=”<img src=”” . $output . ‘” />’; … Read more

How can I store a file in the database in the same way WordPress and ACF do?

ACF doesn’t store any file in Database, it simply provides meta fields with user friendly interface. You can however, store them yourself. To store a field, you need to be familiar with PHP a bit. Here’s how saving a meta field happens, by using the add_post_meta() function: add_post_meta ( $post_id, ‘meta_key’, ‘meta_value’, $is_unique ); There … Read more

get_posts of Custom Post Type AND Custom Taxonomy

You use multiple taxonomies at once, so use’relation’ => ‘AND’: <?php $args = array( ‘posts_per_page’ => -1, ‘post_type’ => ‘products’, ‘post_status’ => ‘publish’, ‘tax_query’ => array( ‘relation’ => ‘AND’, // this is what was missing array( ‘taxonomy’ => ‘subjects’, ‘field’ => ‘name’, ‘terms’ => $shortcode_atts[‘subject’], ), array( ‘taxonomy’ => ‘plans’, ‘field’ => ‘name’, ‘terms’ => … Read more