Unable to check if plugin is active
Try to check class_exists: <?php if( class_exists(‘acf’) ) { echo “hi”; } ?>
Try to check class_exists: <?php if( class_exists(‘acf’) ) { echo “hi”; } ?>
By going through your question I want to tell you that woocommerce will not use your custom template. It will use its own template. As you want to use wordpress advanced custom fields plugin I want to tell you is that feature only works on the page and post. So as woocommerce will not allow … Read more
I’m not 100% sure if I get your problem right, but… Maybe this will help you… Media uploader gets attachments with simple WP_Query, so you can use many filters to modify it’s contents. The only problem is that you can’t query posts with specific CPT as parent using WP_Query arguments… So, we will have to … Read more
You mean get_the_terms()? <?php $terms = get_the_terms( $post->ID, ‘block_type’ ); foreach($terms as $term) { echo $term->name; } ?> Or have I simplified this too much?
And for displaying result for Filter then try this code add_filter( ‘parse_query’, ‘prefix_parse_filter’ ); function prefix_parse_filter($query) { global $pagenow; $current_page = isset( $_GET[‘post_type’] ) ? $_GET[‘post_type’] : ”; if ( is_admin() && ‘competition’ == $current_page && ‘edit.php’ == $pagenow && isset( $_GET[‘competition-name’] ) && $_GET[‘competition-name’] != ” ) { $competition_name = $_GET[‘competition-name’]; $query->query_vars[‘meta_key’] = ‘competition_name’; … Read more
This solution works with get_items() in /lib/endpoints/class-wp-rest-posts-controller.php of the v2 WP Rest API. First, you’ll want to construct the GET arguments like you would for a new WP_Query(). The easiest way to do this is with http_build_query(). $args = array ( ‘filter’ => array ( ‘meta_query’ => array ( ‘relation’ => ‘AND’, array ( ‘key’ … Read more
From the codex for custom fields: The PostMeta information is stored in a new table, $wpdb->postmeta. This table has four fields: ‘meta_id’ – A unique id for each entry. ‘post_id’ – The ID of the post for this metadata. ‘meta_key’ – The name of the ‘key’. ‘meta_value’ – The value associated with the key. This … Read more
You can see in the docs that you get the values by get_field(), so do something like this: $values = get_field( ‘field_name’ ); if ( $values ) { echo ‘A value is set’; } else { echo ‘A value is not set’; } Change field_name to your wanted field.
On a WordPress page, I’m having the post image as a background-image in the header. Here’s how it is solved: What I want now is add a second image to the post (Advanced Custom Fields??) which should be displayed on hover. How can I achieve this? EDIT Since not every header image has a second … Read more
There are some issues with your js file. Try this: You can see this jsfiddle for demo.